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.
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 withyoutube.comin thehrefattribute. You can do the same for Twitter, Facebook, etc by replacingyoutube.comwith the URL to those sites.