Question

Why wont this work in IE 7? Any help would be greatly appreciated!

http://www.k-e-w-l.ca/slideToggle.php

Was it helpful?

Solution

I've played around for a little bit and it seems you want to enable the click action on the link that is being clicked, rather than the li element.

$(document).ready(function() {
    $(".toggle_container").hide();

    $("li.trigger a").click(function() {
        $(".toggle_container").hide();
        $(this).toggleClass("active").next().slideToggle("slow");
    });

});

$ is just an alias for jQuery

There's also a problem with your HTML, in that you have divs as children of your ul element. You can just have another ul within the list item itself. As another point, an ID should be unique for each DOM element.

I've put this up as a jsFiddle here: http://jsfiddle.net/8q8jy/1/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top