dodgerogers747
dodgerogers747

Reputation: 3345

jQuery toggle not working in IE

I have some jQuery code that works absolutely fine on everything other than IE. The toggle action doesn't trigger and doesn't hide or show the footer element.

I have tried to use a conditional if and else statement to use hide() and show() instead of toggle, I have also tried adding language and src elements to the script tag but neither of these angles worked. I have the latest doctype declared and i'm using the latest version of wordpress.

Can anyone see why this isn't working in IE?

<script>
$(document).ready(function() {
    $("#clickme").click(function() {
        event.preventDefault()
        $("#footer").toggle(2000);
        $('#menu, #menu2, #menu3, #menu4').hide('slow');
        $(this).html(($('#clickme').text() == 'Show') ? 'Hide' : 'Show');
        $(this).toggleClass("active");
        $(this).attr("title", ($(this).hasClass("active") ? "Show" : "Hide") + " the menu");
    });
});​
</script>

Upvotes: 0

Views: 2509

Answers (1)

The Alpha
The Alpha

Reputation: 146201

You are using

$("#clickme").click(function() {
    event.preventDefault();//^ event parameter is missing, so causing error
    // ...
});

It should be

$("#clickme").click(function(event) {
    event.preventDefault(); // ^
    // ...
});

Upvotes: 3

Related Questions