Advertisement
Guest User

add blank links

a guest
Nov 28th, 2015
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.16 KB | None | 0 0
  1. $('a').each(function() {
  2.    var a = new RegExp('/' + window.location.host + '/');
  3.    if (!a.test(this.href)) {
  4.       $(this).attr('target','_blank');
  5.    }
  6. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement