Lesson Code: http://www.developphp.com/video/JavaScript/Change-CSS-Class-Style-className-Toggle-Tutorial
Learn to change, toggle and swap CSS classes using JavaScript event handling.
Original source
JavaScript Change CSS Class Style className Toggle Tutorial
…, (Programming, appearance, change, class, className, css, design, Development, display, function, html, javascript, javascript tutorial, learn, style, swap, toggle, tutorial, Web
20 responses to “JavaScript Change CSS Class Style className Toggle Tutorial”
dude this is a great video. much clearer and straightforward than a lot of what is found on stack overflow. good pace.
Careful with the .children() thing, on IE<=8 (yeah old, but still used) it will list comments as children as well.
This is help me a lot 🙂 thanks
Have you a Video with the same when the 4 DIVs have own classNames = class1a, class1b, class1c and class1d ?
Thanks for putting in the time to make these resources! They are super useful for me…so if your goal was to help me specifically, you succeeded. 🙂
Awesome! This is EXACTLY what I need. I only had one problem: I need many different buttons. Not several like one, but several that are each individual. I tried copying all of the coding and changing "class1" to "class3" and "class2" to "class4" but when I load my site and click the original (class1) it disappears. But my class3 works normal…?
What about if you wanted to change the property of another element
ie: in the first example, click the first box and the third box changes (or any other element). Which selector would I use instead of "this"
This is great! but how do i apply the last example if it in a list..
<ul>
<li class=class2> </li>
<li class=class1> </li>
<li class=class1> </li>
<li class=class1> </li>
</ul>
Thankyou!
can you also do this with .animation()?
Awesome tutorial ! Thank you very much !
Thanks a lot! BTW do you know how I can make it fade with replacing?
Great video bro!! I can't begin to explain the level in which this video helped me. #Mad Respect
Adam thanks for posting this. super helpful.
Thank you, Adam!!
Thanks so much Adam
please one example "media Query" for responsive in toggle java add or remove class???
… and once again thx Adam for making us better coders.
To me there is no one out there more inspiration to do a better job and move forward then you are.
And I don't know HOW you do it, but you are bringing up every time something that I need right in that moment when you publish a tutorial 😀
Great, I love these "jquery" is overkill videos!
Great tutorial, Thanks Adam (;
Simple, but very nice video. I think this will help a lot of people out there!