About 4,480,000 results
Open links in new tab
  1. javascript - addEventListener vs onclick - Stack Overflow

    This Stack Overflow page discusses the differences between addEventListener and onclick in JavaScript.

  2. JavaScript: What is addEventListener? - Stack Overflow

    Apr 23, 2010 · The addEventListener method is the W3C standard method to attach an event handler to an element, so that you can do something useful when an event is triggered. The following example …

  3. javascript - How to pass arguments to addEventListener listener ...

    Nov 2, 2008 · Learn how to pass arguments to addEventListener listener functions effectively in JavaScript with this guide.

  4. javascript - Correct usage of addEventListener () / attachEvent ...

    The difference being is that attachEvent can only be used on older trident rendering engines ( IE5+ IE5-8*) and addEventListener is a W3 standard that is implemented in the majority of other browsers (FF, …

  5. Pure JavaScript listen to input value change - Stack Overflow

    Apr 4, 2023 · el.addEventListener('input', function () { fn(); }); But, if you want to fire event when you change inputs value manually via JavaScript you should use custom event (any name, like …

  6. javascript - Difference between document.addEventListener and …

    While using PhoneGap, it has some default JavaScript code that uses document.addEventListener, but I have my own code which uses window.addEventListener: function onBodyLoad(){ document.

  7. AddEventListener on all created li elements - Stack Overflow

    You'll have to set the eventListener on each single item, as document.getElementsByClassName() returns a collection of items and you can't simply add an event listener to all of them with one call of …

  8. JavaScript click event listener on class - Stack Overflow

    Aug 9, 2016 · If you use element.addEventListener ('click', event => { } to add the event to the element, the javascript will check every click internally anyway. If you add the event to all element of classes …

  9. How can I listen to the form submit event in javascript?

    About EventTarget.addEventListener, check out this documentation on MDN. To cancel the native submit event (prevent the form from being submitted), use .preventDefault() in your callback function,

  10. javascript - addEventListener calls the function without me even asking ...

    second.addEventListener('click', message_me, 'shazam'); remember that in JS having () after the function name automatically calls the function and use the returned value.