Add Class and Remove Class | Snippets | kirupa.com

by kirupa | 16 October 2012

You will often run into situations where you want to alter the look of something using JavaScript. The look of this "something" is often declared using CSS. Instead of debating between using JavaScript or CSS, you can actually do both as described in my Changing CSS Using JavaScript tutorial by fiddling with an element's class value.


This is a companion discussion topic for the original entry at http://www.kirupa.com/snippets/add_class_and_remove_class_snippet.htm