Last active
August 29, 2015 14:05
-
-
Save craigmdennis/fe6944f860559ff57357 to your computer and use it in GitHub Desktop.
Open all external links in a new window with one line of jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.content').on('click', 'a[href*="//"]:not([href*="mysite.com"])', function(){ | |
$(this).attr('target','_blank'); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready( fucntion(){ | |
$('.content a[href*="//"]:not([href*="mysite.com"]').attr('target','_blank'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment