Thanks for the quick reply evo-2 : it's run! I've tried this before but not
with the ul balise maybe why it doesn't work?

Good day !


evo-2 wrote:
> 
> 
> $("ul li a").each(function(){
>              $(this).addClass("tooptip2");
> });
> 
> Aysseline wrote:
>> Hi
>>
>> I've got a  list of image with links and need to add a class on the fly
>> on
>> the ahref link. The output is like that
>> <ul>
>> <li> http://www.site.com/  http://www.imageurl.com/img.png  </li>
>> <li> http://www.site.com/  http://www.imageurl.com/img.png  </li>
>> <li> http://www.site.com/  http://www.imageurl.com/img.png  </li></ul>
>>
>> and I want this (class="tooltip2") :
>> <ul>
>> <li> http://www.site.com/  http://www.imageurl.com/img.png  </li>
>> <li> http://www.site.com/  http://www.imageurl.com/img.png  </li>
>> <li> http://www.site.com/  http://www.imageurl.com/img.png  </li></ul>
>>
>> I need to do this because all is auto-generated I can only add this class
>> with jQuery. I tried different code but my knowledge isn't sufficient
>>
>> jQuery(".gallery li a[href^='url']").addClass("tooltip"); or
>> jQuery(".gallery li a").each(function() {
>>     jQuery(this).attr("href").addClass("tooltip"); });
>>
>> and many other tricks doesn't work. I need help to achieve this, thanks
>>   
> 
> 

-- 
View this message in context: 
http://www.nabble.com/addClass-on-ahref-link-on-the-fly-tp22946637s27240p22947135.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to