HTML:
<a href="http://www.google.com" rel="external">Google</a>
Javascript:
$(document).ready(function() { $("a[rel=external]").attr('target', '_blank'); });
Or
$(document).ready(function() { $('a[rel="external"]').click( function() { window.open( $(this).attr('href') ); return false; }); });
examples please, i can’t imagine that, and i don’t have time to try it myself
thank you in advance
useful! thanks man and thanks to jquery :-)
Nice, but in FF 3.6.3 on Win7 it opened in same tab first example(short one).
Terrific. Thank you very much for sharing. I did wonder what you were supposed to do with no target attribute allowed in XHTML.
Further to Eugene’s comment above, the top example works fine for me.
Neither works for me in FF 3.6.3
$(document).ready(function() {
can be replaced with
$(function(){
Doesn’t work in IE9. Opens in the same window (same browser tab).
Sorry, I meant it doesn’t work in IE8. I haven’t tried it in IE9 yet.