From d5a72c2a38b08cbdfe7dd75668ddf35647a9f129 Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Fri, 22 Mar 2024 13:32:58 -0700 Subject: [PATCH] Use event listeners instead of deprecated event --- primed/static/js/project.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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); +}