$.extend( $.expr[':'].external = function(obj){ if(obj.hostname == location.hostname){ return false; } return true; }); /*************** Example for use, open all external links in new window i.e, add target _blank to all external links: ***************/ $(document).ready(function(){ $('a:external').each(function(){ $(this).attr("target", "_blank"); }); });
[jQuery] Find External Links
Page 1 of 10 Replies - 1052 Views - Last Post: 17 May 2011 - 07:08 AM
#1
[jQuery] Find External Links
Posted 17 May 2011 - 07:08 AM
Description: This snippet extends the standard JQuery, and add a new selector, external, to find external links.
Page 1 of 1