Menu toggle for responsive design IE8!!
Hi,
I have made a drop down menu system for a responsive website, but for some reason IE8 does not like the following code:
$(".menu-toggle").on('click', function (e) {
$("#main-nav a[class^='menu-item']").each(function(i) {
if ($(this).hasClass("menu-item-on")) {
$(this).removeClass("menu-item-on");
}
else {
$(this).addClass("menu-item-on");
}
});
e.preventDefault;
});
It looks like it is adding the menu-item-on class then quickly removing it again! It seems to be working fine in IE9 and 10.
Can anybody help me here?