从jquery中排除每个类 [英] exclude a class from jquery for each
本文介绍了从jquery中排除每个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码就是这样
$("a[href]").each(function () {
if ($(this).attr("href").toLowerCase().indexOf("javascript:") != 0 && $(this).attr("class") != "to-top")
{
$(this).attr("href", new URI($(this).attr("href")).removeQuery("at").addQuery("at", $.cookies.get('ACCT_TYPE') != null ? $.cookies.get('ACCT_TYPE') : "erhverv"));
}
});
现在我想避免这种情况的特定链接."a"链接来自"tax-switch"类.有没有捷径可以实现这一目标?
now i want to avoid a specific link from this condition ."a" links comes 'under tax-switch' class. is there any short cuts to achieve this?
推荐答案
正如@vivek所说,请使用not
函数:
As @vivek has said, use the not
function:
$('a[href]').not('.tax-switch').each(
这将选择所有不具有"tax-switch"类的锚点.
This'll select all anchors that do not have the class 'tax-switch'.
这篇关于从jquery中排除每个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文