/ Published in: jQuery
Expand |
Embed | Plain Text
$('a[rel*=external]').click( function() { window.open(this.href); return false; }); // Better Solution // thanks to: emelendez $('body').delegate('a[rel=external]', 'click', function(){ window.open(this.href); return false; })
Comments
Subscribe to comments
You need to login to post a comment.

if you have lots of "a" tags (normal) in your page (imagine 100 anchors) then it binds "n" times to each one.
In that case it is better to delegate (once) to a parent (body, in general):
$('body').delegate('a[rel=external]', 'click', function(){ window.open(this.href);return false;})