/ Published in: JavaScript
Open a new window without using target="_blank" for XHTML 1.1. Need jQuery Framework : http://jquery.com/
Expand |
Embed | Plain Text
$('a[@rel$='external']').click(function(){ this.target = "_blank"; }); /* Usage: <a href="http://www.lepinskidesign.com.br/" rel="external">lepinskidesign.com.br</a> */
Comments
Subscribe to comments
You need to login to post a comment.

You can also do this:
$('a[rel=external]').attr('target', '_blank');
More useful jQuery snippets at http://eisabainyo.net/weblog/2010/09/01/10-useful-jquery-snippets/
Make sure to put this code below your links to work.
just wondering if I want to make rel="nofollow" the links using this method if the Googlebot will really consider it. Anyone?
here even more simplified:
$('a').attr('target', '_blank');
and for rel=nofollow: $('a').attr('rel', 'nofollow');
here even more simplified:
$('a').attr('target', '_blank');
and for rel=nofollow: $('a').attr('rel', 'nofollow');