我想在 '.mainClass_
n'
上切换最近的类 '.wdm_bundled_item'
我尝试过的:
jQuery('.mainClass_1').on('click', function(e){
e.preventDefault();
$(this).nextUntil('.codeByBilal').toggle();
});
工作正常,只是问题是当我点击 '.mainClass_4'
tr
请问有什么建议吗?与 nextUntil
或其他东西。
谢谢
最佳答案
使用filter()
过滤出具有所需类的元素。
jQuery('.mainClass_1').on('click', function(e){
e.preventDefault();
$(this).nextUntil('.codeByBilal').filter('.wdm_bundled_item').toggle();
});
关于javascript - nextUntil hasClass jQuery,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43522282/