/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
/* ------------------------------------------------------------------ External Link ---------------------------------------------------- */ $.fn.externalLinks = function(arrDomains) { return this.each( function() { $("a", this) .filter(function(){ for ( var i=0; i < arrDomains.length; i++ ){ if(this.href.indexOf(arrDomains[i])>-1 ) { return false; }else{ return true; } } }) .attr({ target:"_blank", rel:"external" }); }); };