如何在jQuery中选择具有多个类的元素?

会有一股神秘感。 提交于 2020-08-11 02:08:09

问题:

I want to select all the elements that have the two classes a and b . 我想选择具有两个类ab所有元素。

<element class="a b">

So, only the elements that have both classes. 因此,只有具有两个类的元素。

When I use $(".a, .b") it gives me the union, but I want the intersection. 当我使用$(".a, .b")它会给我联合,但是我想要交点。


解决方案:

参考一: https://stackoom.com/question/4Mts/如何在jQuery中选择具有多个类的元素
参考二: https://oldbug.net/q/4Mts/How-can-I-select-an-element-with-multiple-classes-in-jQuery
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!