1
我试图通过':not()'过滤元素列表,而jQuery似乎忽略了我的过滤器。jQuery:正确的语法':not()'
这里是代码:
myElements.filter(':not(.someclass)');
jQuery的仍然选择所有myElements的...
我试图通过':not()'过滤元素列表,而jQuery似乎忽略了我的过滤器。jQuery:正确的语法':not()'
这里是代码:
myElements.filter(':not(.someclass)');
jQuery的仍然选择所有myElements的...
myElements = myElements.filter(":not(.someClass)");
myElements.hide();
或:
myElements = myElements.not(".someClass");
myElements.hide();
实际上,你将需要分配过滤收集到一个变量来捕获修改(过滤)的集合,否则你实际上只是参考myElements
处于初始状态。如果你不想这样做,你可以随时使用链接,例如:
myElements.filter(":not(.someClass)")
.hide();