【发布时间】:2015-07-22 09:46:11
【问题描述】:
if($("ul.multicb > li").hasClass('active')) {
$(this).children().removeAttr("href");
}
我想从包含 .active 类的 li 的子级锚链接中删除 href 属性,但我的代码似乎不起作用。我该怎么做?
【问题讨论】:
标签: attributes href children
if($("ul.multicb > li").hasClass('active')) {
$(this).children().removeAttr("href");
}
我想从包含 .active 类的 li 的子级锚链接中删除 href 属性,但我的代码似乎不起作用。我该怎么做?
【问题讨论】:
标签: attributes href children
if($("ul.multicb > li").hasClass('active')) {
$(this).find('a').each(function(){
$(this).removeAttr("href");
})
}
【讨论】:
if($("ul.multicb > li").hasClass('active')) { $("ul.multicb > li > a").removeAttr("href"); }