0
我想将外部类添加到不在我们域上的链接...容易找到解决方案,但它不捕获子域。将外部类添加到不在域或子域上的链接
那么,如何在只有href主机位置不包含'hw.ac.uk'的标签上使用addClass(“external”)?
以下是流行,但不赶子域(其中我们可以是一个或两个深,例如,子域,www.subdomain。等)
$("a").filter(function() {
return this.hostname && this.hostname !== location.hostname;
}).addClass('external');
我想我想的相反的add class to all links that link to a certain domain with js (jquery)
感谢
尼尔
对不起,没有赶上子域问题,当我第一次阅读! – oleron 2013-02-20 12:09:57