the problem is I want to change the src of img tag by using the button which executes if, else function. but I think my code is unprofessional and there is a better way to do the same job. Answer Here is another solution, wich is just 5 lines of JS. It uses if-else oneliners, to wich a detailed guide
Tag: toggle
Copy active class from one div to another div with a corresponding data attribute value
Is there a way to toggle the class selected that is currently set on the button in .ProductItem-gallery-slides to the corresponding button in .ProductItem-gallery-thumbnails with the same data attribute? Answer Whilst I agree with Rory – I suspect there is no example code so I hope the following is what you’re after:
Accordion is not working when I click the button
I’m trying to add the accordion in my page. But when I click the button it’s not toggling. Here is my Html Answer Your stylesheet is sass/scss and needs to be compiled or translated to plain CSS (which is the answer to your question) Also I suggest you delegate
Why my green border doesn’t toggle?(disappear)
Why I can’t toggle the className in each div? I want to give each div a green border when I double click on h1 tag inside each div and when I double click again I want border to disapper I put image for you to understand my situation If you don’t get the problem comment under the question Answer Check
How to Switch off and ON the toggle Button based on the click event on icon
In my angular application I have some font icons and also I have one toggle switch ,by default the toggle switch is in ON state. And My requirement is when I click on any of the icon(the color of the icon should changed from white to red and this was done).the toggle switch should turned to OFF state and when
How can I click to slide open divs in multiple instances independently of one another?
I have the following markup, below. Essentially, they are the same type of section with a heading, and some of them will have a panel that’s initially invisible but will open when you click js-toggle. Not every .article will have the panels and triggers, and also some of them will have an external link. I’m trying to make it so
Close other div when new div is opened (in forloop.counter)
I am trying to close the other div when I open a new div, But I am using in loop so I used forloop.counter But it is not working. And when I try to use without forloop.counter or outside the loop then it is working fine, but I want to use inside the for loop. page.html I have also tried
can’t remove class after click again
I tried to color the text I clicked on by gave them a class and besides the text I click on the original color is back again, but when I click on the text twice the class can’t be removed. I use toggle class for this issue but doesn’t work. Answer Cache the main list element, and the list items,
How to handle event element in container?
I want to click btnToggle, Navigation will run but I don’t know why this code sometimes is successful, sometimes is unsuccessful. Help me please, thanks all Answer You’re pretty close. Because you attached the event listener to document, your callback function will actually run if you click anywhere on the page. And because browsers have something called event bubbling, that
Toggle classes with this as an event handler in jQuery
I want to toggle the content class independently when I click the collapsible class button associated with it. I read briefly on using this in event handlers. The way I’ve used it so far, I end up toggling the collapsible class (i.e the button) instead. This is close to what I want but instead of toggling the button I want