adding event listener with forminator
-
I built a form with Forminator, and have a text area that I’d like to open an alert when it is clicked. In the code below, the point 1 alert comes up when the page loads, but when I click on the element #html-1, nothing happens. I have a feeling the problem is the content hasn’t been completely loaded, but the DOMContentLoaded listener should have solved that. Is there anything about Forminator causing this? thnks!
document.addEventListener("DOMContentLoaded", function () { var element = document.getElementById("html-1"); alert('point 1') if (element) { alert(point 2') element.addEventListener("click", function () { alert("Element with ID 'html-1' was clicked!"); }); } });
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘adding event listener with forminator’ is closed to new replies.