Skip to content Skip to sidebar Skip to footer

Jquery Add And Remove Classes Not Working Ie8

I am not the greatest at jQuery so forgive me if this is a simple question. I have created a nav menu active state function Click here for the demo It works fine in Chrome, Firefo

Solution 1:

I don't have a working version of IE8 (the horror!).. But since your "this" is already the button you're clicking on, why not change the last line to this:

                $(this).addClass('blue');

As seen here (like I said: can not test it) : http://jsfiddle.net/vXmNU/1/

EDIT

Updated the fiddle to match the parent to the li: http://jsfiddle.net/vXmNU/2/

$(this).parent("li").addClass('active');

Solution 2:

After almost burning my head down:

Try to comment out all console.log Events. I'm running IE8 in a Virtual Machine and if i have any console.log Event triggered, the javascript will stop working. It will not run any other javascript code after the console.log.

So: Try to comment out / remove all console.log - It's a IE8 Bug, because earlier there was alert(); to debug things.

for digging deeper: What happened to console.log in IE8? (thanks to kamui)

Post a Comment for "Jquery Add And Remove Classes Not Working Ie8"