Setting CSS Styles using JavaScript | kirupa.com

Good catch! It wouldn’t work because of this line right here:

if (currentClassValue.indexOf(classToAdd) == -1) {

I’ll update the example shortly. I’ll also emphasize more strongly that everyone should use classList instead of doing this manually: http://www.kirupa.com/html5/using_the_classlist_api.htm

:smiley: