Selector doesn't work in IE

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Selector doesn't work in IE

Simon Morris-2
Hello,

I have a problem with a jQuery selector that works in both Firefox and
Chrome but refuses to in Internet Explorer.

The jQuery line looks like

$('a[id*="show_ingredients_link"]').click(function(){
    var id = this.id.replace("show_ingredients_link", "");
    $(".ingredient_row" + id).toggle();
    return false;
});

Which is trying to select a click on the following bit of HTML (this is
a Django template)

<a href="#" id="show_ingredients_link{{ i.id }}">(Customise)</a>

The intent is to toggle the visibility of some table rows that exist
just below the (Customise) link.

I can tell this is a selector problem by adding an alert(); in the click
function which isn't fired in IE.

Thanks for any help you can give.

~sm



--
You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Selector doesn't work in IE

Roman-87
Try omitting the quotes in the filter: $
('a[id*=show_ingredients_link]'). If this doesn't work, make sure that
your HTML structure is correct.


On Sep 13, 5:22 am, Simon Morris <[hidden email]> wrote:

> Hello,
>
> I have a problem with a jQuery selector that works in both Firefox and
> Chrome but refuses to in Internet Explorer.
>
> The jQuery line looks like
>
> $('a[id*="show_ingredients_link"]').click(function(){
>     var id = this.id.replace("show_ingredients_link", "");
>     $(".ingredient_row" + id).toggle();
>     return false;
>
> });
>
> Which is trying to select a click on the following bit of HTML (this is
> a Django template)
>
> <a href="#" id="show_ingredients_link{{ i.id }}">(Customise)</a>
>
> The intent is to toggle the visibility of some table rows that exist
> just below the (Customise) link.
>
> I can tell this is a selector problem by adding an alert(); in the click
> function which isn't fired in IE.
>
> Thanks for any help you can give.
>
> ~sm

--
You received this message because you are subscribed to the Google Groups "jQuery UI" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.