0

这是我的代码 在此处输入图像描述

我想'.wdm_bundled_item''.mainClass_n上切换最近的班级'

我尝试过的:

jQuery('.mainClass_1').on('click', function(e){
        e.preventDefault();
        $(this).nextUntil('.codeByBilal').toggle();
    });

工作正常,只是问题是tr当我点击时它也在切换最后一个'.mainClass_4'

请问有什么建议吗?与nextUntil或其他东西。谢谢

4

1 回答 1

2

用于filter()过滤掉具有所需类的元素。

jQuery('.mainClass_1').on('click', function(e){
  e.preventDefault();
  $(this).nextUntil('.codeByBilal').filter('.wdm_bundled_item').toggle();
});
于 2017-04-20T14:42:00.103 回答