如何在父类处于活动状态时删除子属性

时间:2015-07-22 09:46:11

标签: attributes href children

 if($("ul.multicb > li").hasClass('active')) {
     $(this).children().removeAttr("href");
 }

我想从包含类.active的li的子节点的锚链接中删除href属性,但我的代码似乎不起作用。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

if($("ul.multicb > li").hasClass('active')) {
 $(this).find('a').each(function(){
   $(this).removeAttr("href");
})
}
相关问题