About 429,000 results
Open links in new tab
  1. JavaScript HTML DOM EventListener - W3Schools

    The addEventListener() method allows you to add many events to the same element, without overwriting existing events: Example element .addEventListener("click", myFunction);

  2. EventTarget: addEventListener() method - Web APIs | MDN - MDN Web Docs

    Apr 28, 2025 · The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target. Common targets are …

  3. JavaScript click event listener on class - Stack Overflow

    Aug 9, 2016 · There's a problem with the code that's adding the event listener. addEventListener takes the event name ('click'), reference to the function (not the result of the function as it is …

  4. JavaScript addEventListener() with Examples - GeeksforGeeks

    Jan 10, 2025 · The addEventListener() method attaches an event handler to the specified element. Syntax: element.addEventListener(event, function, useCapture) Note: The third …

  5. The addEventListener() Method – JavaScript Event Listener

    Jul 27, 2020 · The JavaScript addEventListener() method allows you to set up functions to be called when a specified event happens, such as when a user clicks a button. This tutorial …

  6. Add an Event Handler - JavaScript Tutorial

    To add an event handler to an event of an element, you use the addEventListener() method of the element object: Suppose that you have a button with the class .btn: To attach an event handler …

  7. HTML DOM Element addEventListener() Method - W3Schools

    The addEventListener() method attaches an event handler to an element. Required. The name of the event. Do not use the "on" prefix. Use "click" not "onclick". The Complete List of DOM …

  8. javascript - addEventListener vs onclick - Stack Overflow

    You can also add an event listener using a function reference or a closure: const myFunctionReference = function() { /* do stuff here*/ } element.attachEvent('onclick', …

  9. How To Add Event Listener In JavaScript - DEV Community

    Mar 7, 2025 · How Do I Use the addEventListener Method? The method I use most often is addEventListener (). This built-in JavaScript function attaches an event handler to a specified …

  10. How to Add event listener to Button in JavaScript - GeeksforGeeks

    Jul 22, 2024 · The addEventListener method is a versatile and widely used way to attach event listeners to elements. It allows us to add multiple events to a single element and provides …

  11. Some results have been removed
Refresh