Created
July 28, 2013 07:04
-
-
Save flowerains/6097770 to your computer and use it in GitHub Desktop.
jquery,使链接在新窗口打开
This file contains 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
$(function(){ | |
//例子1 :href="http://"的超链接将会在新窗口打开链接 | |
$('a[href^="http://"]').attr("target","_blank"); | |
//例子2 :rel="external"的超链接将会在新窗口打开链接 | |
$("a[rel$='external']").click(function(){ | |
this.target = "_blank"; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment