Select more than one class name in the same obj

This question already has an answer here:

  • How can I select an element with multiple classes in jQuery? 10 answers

  • 你可以像下面这样使用class selector

    var typeselect = $('div.type1.type2');
    

    You use .type1.type2 (note: no space) to select only elements that have both classes. See the specification for more about selectors.

    This is just an application of the general principal that selector elements can be combined. That is, you can combine an ID seletor like #foo with a class selector like .bar to be #foo.bar (only find the element if it has both the ID and the class). Or combining a class selector with an attribute selector: .foo[data-special] (only find the element if it has the class and that attribute). Or combining a tag selector with a pseudoclass: div:hover .

    链接地址: http://www.djcxy.com/p/83104.html

    上一篇: 用Javascript中的类调用一个类

    下一篇: 在同一个obj中选择多个类名称