About 830,000 results
Open links in new tab
  1. onClick to get the ID of the clicked button - Stack Overflow

    Learn how to get the ID of a clicked button using onClick event in JavaScript.

  2. How to set onClick with JavaScript? - Stack Overflow

    Nov 30, 2012 · 55 I am trying to set the onclick event using javascript. The following code works: var link = document.createElement('a'); link.setAttribute('href', "#"); link.setAttribute('onclick', …

  3. Adding an onclick event to a div element - Stack Overflow

    Firefox shows you events for each element, so you can inspect the element that has an onclick event and see all the events that are bound to it. Another method is to add some logs, like …

  4. How can I trigger a JavaScript event click - Stack Overflow

    Feb 20, 2020 · To trigger a JavaScript event click, use the dispatchEvent method or jQuery's trigger method.

  5. javascript - addEventListener vs onclick - Stack Overflow

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

  6. html - JavaScript button onclick not working - Stack Overflow

    Mar 1, 2017 · using onclick vs EventListeners. The question is a matter of browser compatibility and necessity. Do you need to attach more than one event to an element? Will you in the …

  7. Change onclick action with a Javascript function

    Though others work, adding a function directly to onclick may not work in some scenarios. I faced an issue in a case where creating multiple buttons in a loop and assigning a function for …

  8. How to get the onclick calling object? - Stack Overflow

    How to get the onclick calling object? Asked 15 years, 9 months ago Modified 11 months ago Viewed 280k times

  9. Adding an onclick function to go to url in JavaScript?

    I am using this fancy little JavaScript to highlight a field as the user hovers over it. Could you please tell me if there is a way of adding an onclick function which will act as a link and go to ...

  10. How can I make a button redirect my page to another page?

    May 15, 2013 · for those using bootstrap, might want to route to a function onclick="myfunc(e)" and add e.preventDefault() in myfunc to disable default button behavior.