have the same "_self" target via jQuery or javascript? ...">

How to do everything <a> has the same goal = "_ self"

How can I make sure all links <a>have the same "_self" target via jQuery or javascript?

+5
source share
3 answers

Put this in <head>:

<base target="_self">

No JavaScript needed - HTML has a built-in feature!

+17
source
$('a[href]').attr('target','_self');

Note. This will replace all the tags ANCHORtag targeton the page. RichieHindle's answer would be better if you just want to add them where they are not announced.

+2
source
$('a').attr('target', '_self');
+1
source

All Articles