jquery find element by specific class when element has multiple classes

后端 未结 5 1174
Happy的楠姐
Happy的楠姐 2021-01-30 22:15

So I am working on something that wasn\'t well thought out in the build from the backend team. That leaves me with a document full of divs.

What I am doing is rolling b

5条回答
  •  天涯浪人
    2021-01-30 22:46

    An element can have any number of classNames, however, it can only have one class attribute; only the first one will be read by jQuery.

    Using the code you posted, $(".alert-box.warn") will work but $(".alert-box.dead") will not.

提交回复
热议问题