From 97adf2f7fde94d6e4e110de60eaed2944b332ad8 Mon Sep 17 00:00:00 2001 From: Jascha Urbach Date: Sat, 14 Oct 2023 17:21:15 +0200 Subject: [PATCH] I changed my own comments to get rid of this warning which I could have better written in the first place. --- bookwyrm/static/js/forms.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bookwyrm/static/js/forms.js b/bookwyrm/static/js/forms.js index 08066f137..4a075506e 100644 --- a/bookwyrm/static/js/forms.js +++ b/bookwyrm/static/js/forms.js @@ -47,12 +47,11 @@ .querySelectorAll("[data-remove]") .forEach((node) => node.addEventListener("click", removeInput)); - // Get the element, add a keypress listener... + // Get 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 + // Linstening to element e.target + // If e.target is an input field within "subjects" div preventDefault() if (e.target && e.target.nodeName == "INPUT") { - // Item found, prevent default if (event.keyCode == 13) { event.preventDefault(); }