views:

347

answers:

1

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?

+4  A: 

Have you tried using the $ within the selector, like

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

so that it matches the src properties ending?

MytyMyky
+1 correct. IE returns the (translated) **absolute URL** for the `src` attribute instead of the actual value.
BalusC
worked perfectly thanks, i've never seen this before!
Paul Creasey