diff --git a/primed/static/js/project.js b/primed/static/js/project.js index 62e8fcab..9c90629e 100644 --- a/primed/static/js/project.js +++ b/primed/static/js/project.js @@ -2,7 +2,7 @@ // Handle paste event for text inputs with maxlength. const checkPasteLength = (e) => { - var paste = (event.clipboardData || window.clipboardData).getData("text"); + var paste = (e.clipboardData || window.clipboardData).getData("text"); maxlength = e.target.getAttribute("maxlength"); if (paste.length > maxlength) { alert("String longer than allowed maximum length of " + maxlength + " characters:\n" + paste) @@ -12,4 +12,8 @@ const checkPasteLength = (e) => { } var textInputs = $('form').find("input[maxlength]") -textInputs.on("paste", checkPasteLength); +// textInputs.on("paste", checkPasteLength); +for(var i = 0; i < textInputs.length; i++){ + // Console: print the clicked
element + textInputs[i].addEventListener("paste", checkPasteLength); +}