JQuery for Everyone: Dressing-up Links Pt1
We had a request from Ari in our last installment of JQuery for Everyone! Ari wants to know how to add fancy “this is an external link” icons to his page. Since that was basically written for me by Karl Swedberg at Learning jQuery, I decided to take it up a notch (using some AJAX and JSON tricks).

But, if you only need the external link icons:
- Add jQuery to your page (see previous article for different methods)
- Download a good icon (WSS doesn’t seem to have a good one)
- Add the icon to your server (document library or the 12\TEMPLATE\IMAGES directory)
- Place the following script on your page (replacing the image path with your own)
<script type="text/javascript"> $(function() { $('a').filter(function() { return this.hostname && this.hostname !== location.hostname; }).after(' <img src="/PaulGrenier/images1/external.png" alt="external link">'); }); </script>
If you want to do more with this idea, of dressing up links, come back tomorrow and I’ll show you how to add the file size for those external links.
- JQuery for Everyone: Accordion Left Nav
- JQuery for Everyone: Print (Any) Web Part
- JQuery for Everyone: HTML Calculated Column
- JQuery for Everyone: Dressing-up Links Pt1
- JQuery for Everyone: Dressing-up Links Pt2
- JQuery for Everyone: Dressing-up Links Pt3
- JQuery for Everyone: Cleaning Windows Pt1
- JQuery for Everyone: Cleaning Windows Pt2
- JQuery for Everyone: Fixing the Gantt View
- JQuery for Everyone: Dynamically Sizing Excel Web Parts
- JQuery for Everyone: Manually Resizing Web Parts
- JQuery for Everyone: Total Calculated Columns
- JQuery for Everyone: Total of Time Differences
- JQuery for Everyone: Fixing Configured Web Part Height
- JQuery for Everyone: Expand/Collapse All Groups
- JQuery for Everyone: Preview Pane for Multiple Lists
- JQuery for Everyone: Preview Pane for Calendar View
- JQuery for Everyone: Degrading Dynamic Script Loader
- JQuery for Everyone: Force Checkout
- JQuery for Everyone: Replacing [Today]
- JQuery for Everyone: Whether They Want It Or Not
- JQuery for Everyone: Linking the Attachment Icon
- JQuery for Everyone: Aspect-Oriented Programming with jQuery
- JQuery for Everyone: AOP in Action - loadTip Gone Wild
- JQuery for Everyone: Wiki Outbound Links
- JQuery for Everyone: Collapse Text in List View
- JQuery for Everyone: AOP in Action - Clone List Header
- JQuery for Everyone: $.grep and calcHTML Revisited
- JQuery for Everyone: Evolution of the Preview
- JQuery for Everyone: Create a Client-Side Object Model
- JQuery for Everyone: Print (Any) Web Part(s) Plugin
- JQuery for Everyone: Minimal AOP and Elegant Modularity
- JQuery for Everyone: Cookies and Plugins
- JQuery for Everyone: Live Events vs. AOP
- JQuery for Everyone: Live Preview Pane
- JQuery for Everyone: Pre-populate Form Fields
- JQuery for Everyone: Get XML List Data with OWSSVR.DLL (RPC)
- Use Firebug in IE
- JQuery for Everyone: Extending OWS API for Calculated Columns
- JQuery for Everyone: Accordion Left-nav with Cookies Speed Test
- JQuery for Everyone: Email a List of People with OWS
- JQuery for Everyone: Faster than Document.Ready
- jQuery for Everyone: Collapse or Prepopulate Form Fields
- jQuery for Everyone: Hourly Summary Web Part
- jQuery for Everyone: "Read More..." On a Blog Site
- jQuery for Everyone: Slick Speed Test
- jQuery for Everyone: The SharePoint Game Changer
- JQuery For Everyone: Live LoadTip
Thanks Paul, works fine and just the thing I wanted.
Cool article, I’ve also modified your script slightly to work around the annoying problem of not being able to open external links in a new window from within the Quick Launch (WSS not MOSS)!
Slightly hacky, but works none the less!
Steve.
That’s the kind of creativity I like to see :)
Overcome the annoyances of the UI. If you have ext links in your nav, you may want to replace my “file not found” with an icon when you get to pt-3 of this series:
http://www.endusersharepoint.com/?p=1043
Simple! Thank You Paul.
Question: Is there a way to skip running this for certain web parts?
For instance, I have a page I want ot use this on but there is a calendar opened up on the page and all the utility links on the Cal get that image tagged to the link, like prev and next month links.
How can I skip that Webpart? I tried adding a conditional but thats not working:
if $(”div:contains(’WebPartWPQ6′)”) {
return;
}else{
$(’a').filter(function() {
blah blah blah