diff --git a/bookwyrm/static/js/forms.js b/bookwyrm/static/js/forms.js index 998873898..a48675b35 100644 --- a/bookwyrm/static/js/forms.js +++ b/bookwyrm/static/js/forms.js @@ -46,4 +46,16 @@ document .querySelectorAll("[data-remove]") .forEach((node) => node.addEventListener("click", removeInput)); + + // Get the element, add a keypress listener... + document.getElementById("subjects").addEventListener("keypress", function (e) { + // e.target is the element where it listens! + // if e.target is input field within the "subjects" div, do stuff + if (e.target && e.target.nodeName == "INPUT") { + // Item found, prevent default + if (event.keyCode == 13) { + event.preventDefault(); + } + } + }); })(); diff --git a/bookwyrm/templates/book/edit/edit_book_form.html b/bookwyrm/templates/book/edit/edit_book_form.html index 728b4819d..e85164444 100644 --- a/bookwyrm/templates/book/edit/edit_book_form.html +++ b/bookwyrm/templates/book/edit/edit_book_form.html @@ -81,7 +81,7 @@ {% include 'snippets/form_errors.html' with errors_list=form.languages.errors id="desc_languages" %} -
+