views:

26

answers:

1

Hi,

I have just tested this Jquery script with my site http://cool-javascripts.com/jquery/add-icons-to-your-links-automatically-using-jquery-css.html

At present the script creates a default icon for external sites. It would be great to have custom icons for different external sites like Twitter, facebook, and youtube, but I am strugling to convert the script to do this.

Thanks in advance if you can help.

A: 

I'm not sure why you'd need to use jQuery - CSS supports attribute selectors just fine. Cross browser compatibility?

Anyway, the selector you are looking for is a[href*='youtube.com'] which selects any anchors with youtube.com in the href attribute. You can do the same for Twitter, Facebook, etc by replacing youtube.com with the URL to those sites.

Yi Jiang