这里是jQuery的新手.我发现几个网页接近我正在尝试做的事情,但并不完全.实际上,我认为以下内容应该可行,但是它说:
[@href^="http://"]
Run Code Online (Sandbox Code Playgroud)
无法识别(语法错误).有帮助吗?
$(document).ready(function() {
$('a[@href^="http://"]').filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).attr('target', '_blank');
});
Run Code Online (Sandbox Code Playgroud)
谢谢.
不需要@符号.除此之外,你是金色的.
$("a[href^='http://']")...
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2443 次 |
最近记录: |