About 192,000 results
Open links in new tab
  1. I am trying to make a simple toggle button in javascript

    Apr 26, 2021 · Why are you passing the button if you're going to look it up? Also, since you know the possible values, you only need to check if it's OFF, otherwise, you know it's ON.

  2. javascript - Creating the simplest HTML toggle button? - Stack …

    Aug 4, 2023 · document.getElementById('btn-my-toggle') .addEventListener('click', (e) => e.target.closest('button').classList.toggle('pressed'))

  3. javascript - toggle show/hide div with button? - Stack Overflow

    Dec 24, 2010 · Learn how to toggle the visibility of a div using JavaScript and a button.

  4. Apply javascript click function to toggle an HTML element

    Dec 23, 2022 · I am new to Javascript and trying to create a Javascript click function that will display the input element when the button is clicked and hide it when the button is clicked …

  5. dom - How to toggle on / off? (Javascript) - Stack Overflow

    Sep 28, 2018 · I'm trying out JS without jQuery. But so far it's much harder. I'm trying to make a toggle on & off function. This is the function: function toggleDropdown(){ var dropdown = …

  6. How do I toggle an element's class in pure JavaScript?

    2014 answer: classList.toggle() is the standard and supported by most browsers. Older browsers can use use classlist.js for classList.toggle(): var menu = document.querySelector('.menu') // …

  7. How to create a toggle button in Bootstrap - Stack Overflow

    Nov 22, 2012 · In case someone is still looking for a nice switch/toggle button, I followed Rick's suggestion and created a simple angular directive around it, angular-switch. Besides preferring …

  8. html - Toggle Visibility in JavaScript - Stack Overflow

    Aug 12, 2017 · I'm trying to make a button that shows a paragraph on click and hides it on a second click. Instead of using a more traditional method, I went with using JavaScript to …

  9. javascript - Toggle elements on buttons click - Stack Overflow

    Jul 17, 2022 · How to make javascript toggle button? 1. Javascript - Make element clickable and toggle off other button. 0.

  10. html - Javascript toggle switch using data - Stack Overflow

    I have been trying to make a toggle switch that enables/disables a part of my program. The code I use for making the button is taken from here w3schools. Now I wanted to add the functionality …

Refresh