views:

34

answers:

1

I am trying to get the tipsy plugin working and can't seem to do it with dynamic id's. this is the code I was trying to use.

jQuery(document).ready(function(){  
    jQuery("a#[id^='pro_']").each(function(){
        jQuery("a#[id^='pro_']").tipsy({gravity: jQuery.fn.tipsy.autoNS,live: 'true'});
    });
});

a link would look someting like <a id="pro_1" title="some value" href="link.html">My Link</a>

Not sure if the jquery is correct but I tried it several ways. Thanks

A: 

The selector is incorrect. You don't need the "#" there. Just use $('a[id^=pro_]'). The hash sign (#) means the same as [id=…], so it doesn't make sense to use both it and [id^=…].

Reinis I.
Actually it will work either way, but I found my mistake. It was a typo and also using the each function is not necessary with this plugin. Thanks for the response anyway.
Pjack