简体   繁体   中英

jQuery - expand/collapse all button, Internet Explorer problems

I have a custom tree structure type display. I have Expand all and Collapse all buttons, which are hooked up with the following simple jQuery .

        $('#expandAll').click(function() {
            $("img[src='images/plus.gif']").parent().click();
        });
        $('#collapseAll').click(function() {
            $("img[src='images/minus.gif']").parent().click();
        });

This works fine in Firefox, but not in Internet Explorer 7 and presumably not in Internet Explorer 6 either. I'm unsure about Internet Explorer 8 since it is not supported where I work.

How can I make it work in Internet Explorer?

Have you tried using the $ within the selector, like

$("img[src$='images/minus.gif']").parent.click();

so that it matches the src properties ending?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM