About 23,700 results
Open links in new tab
  1. javascript - Onclick class function is not working - Stack Overflow

    Jan 9, 2017 · From the above image i am trying to change the Selected button to Not selected when i select the student the comment box has to appear if Not selected the comment text has …

  2. javascript - How can an HTML button do anything without an onclick

    Aug 19, 2019 · I was hoping that someone might know of some common trick to execute code on a button click without an event handler that I might be unaware of... Not having an onclick …

  3. javascript - How to set a class function to button onclick? - Stack ...

    Jun 23, 2020 · You should be using addEventListener instead of this.button.setAttribute('onclick', 'this.pause()');. Also note that callback function will be assigned with this.pause. Do not wrap it …

  4. How can I change the class of an HTML element in response to an onclick

    How can I change the class of an HTML element in response to an onclick or any other events using JavaScript? You can dynamically change an element's CSS class when certain events …

  5. onclick Event - W3Schools

    The onclick event occurs when the user clicks on an HTML element. onclick is a DOM Level 2 (2001) feature. It is fully supported in all browsers: Well organized and easy to understand …

  6. classList add / remove active class onclick not kept - JavaScript ...

    Sep 27, 2022 · I see the added class - .active - momentarily when I click the button, but then the button reverts to original state. How can I keep the .active class after clicking?

  7. How TO - Add Active Class to Current Element - W3Schools

    Learn how to add an active class to the current element with JavaScript. Highlight the active/current (pressed) button: If you do not have an active class set on the button element to …

  8. Toggle class onclick in plain inline JavaScript - Medium

    Jul 25, 2019 · Learn how to select an HTML element by class and toggle its class in JavaScript. Suppose there’s a button that needs to show/hide a newsletter banner. Newsletter visibility is …

  9. javascript - How to add class to buttons on click - Stack Overflow

    Jul 22, 2019 · Onclick of the button you can set class name to the button. If you going to get rid of jQuery replace wrapper function to use listen for DOMContentLoaded event. It's the same as …

  10. How to Use JavaScript Button Class onclick Event

    When it comes to creating interactive web applications, utilizing JavaScript classes and the onclick event is a common practice. In this blog post, we will explore how to effectively use …

  11. Some results have been removed
Refresh