The title says it all. Instead of putting "target="_blank" on every link, how can I do it with jQuery?
+2
A:
Uh, I guess you could do something like this:
$('a.newWindow').click(function() {
var href = $(this).attr('href');
if(href.length > 0) {
window.open(href);
}
});
Or, just do it the right way:
$('a.newWindow').attr('target', '_blank');
Jacob Relkin
2010-08-05 09:04:21
+3
A:
you don't need jQuery
insert this to your <header>
<base target="_blank" />
est
2010-08-05 09:05:08
Target is deprecated.
Radu
2010-08-05 09:07:36
@Radu No it's not, check this out http://www.w3.org/TR/html5-diff/#new-attributes
est
2010-08-05 09:40:12
@est Ah, wasn't aware they're adding it back in HTML5. Thanks.
Radu
2010-08-05 09:56:48