in React – can i use more than one onClick event for the same component?

i want to toggle AND rotate the image with onClick= {setToggle} and {handleRotate}. it seems i am only able to render one or the other function FAQs() { function useToggle(initialState) { const [toggleValue, setToggleValue] = useState(initialState); const toggler = () => { setToggleValue(!toggleValue); }; return [toggleValue, toggler]; } const [toggle, setToggle] = useToggle(); //setToggle function… Read More in React – can i use more than one onClick event for the same component?

title toggle disappears on click

Trying to make a toggle work that open/closes content. Opening the content works but somehow the button with the title disappears. Why? <script> const show = ref(false); </script> <template> <div class="w-full md:w-1/2 mx-auto my-12 border-8 border-black"> <button v-if="!show" class="bg-blue-500" @click="show = true"> <h2>Hello title, click to open or close content</h2> </button> <div v-show="show" class="bg-red-500"> <p>The… Read More title toggle disappears on click

Change font awesome icon when clicked button

Iam using this code to play/pause background audio. <div class="music-box"> <audio id="losAudio" src="images/honcayeu.mp3"></audio> <button id="btn_playPause"> <i class="fa fa-music"></i> </button> </div> var losAudio = document.getElementById("losAudio"); function losAudio_playPause() { var isPaused = losAudio.paused; losAudio[isPaused ? "play" : "pause"](); } document.getElementById("btn_playPause").addEventListener("click", losAudio_playPause); But now i want when clicked on button, the icon will be change to fa-pause icon.… Read More Change font awesome icon when clicked button

I'm having trouble toggling between id's with onclick function

I’m referencing the documentation on w3schools on how to toggle between id’s/classes but it’s not working with my code. The only difference is that the documentation uses a button element whereas I am using a div and it’s not working. The code: function playSong(track) { player.src = track; player.play(); var element = document.getElementById(“one”); element.classList.toggle(“one-clicked”); }… Read More I'm having trouble toggling between id's with onclick function

Bootstrap 5 data-bs-toggle vs data-toggle. Adding the bs breaks my whole Popper

I’m one month into learning Web Development. From what I’ve read, the data-bs-toggle is the newer name for Bootstrap 5. What is the difference between Bootstrap data-toggle vs data-bs-toggle attributes? My code is simple. In the head, I’ve included CSS, jQuery, and JavaScript Bundle with Popper. In the body, I have two links with a… Read More Bootstrap 5 data-bs-toggle vs data-toggle. Adding the bs breaks my whole Popper

How can I toggle this dropdown?

I have tried adding a simple toggle function to the dropdown-btn class which in turn adds the active class (which is set to display: block;) onto the ul class, am I doing anything wrong here? https://jsfiddle.net/q45yc3vt/10/ HTML <nav class="admin-sidebar sidebar"> <div class="sidebar-nav"> <li><a href="#" class="dropdown-btn"><i class="fas fa-address-card"></i><span>Dropdown</span><i class="fas fa-angle-down"></i></a></li> <ul class="options"> <li>Option 1</li> <li>Option 2</li>… Read More How can I toggle this dropdown?