开发者

jQuery matching multiple classes

For the first time, I got in this kind of unusual situtation

I have to select a div on which more than 2 classes are applied, that to in random order

For Example:

Assume that I have a <div> on which following 3 classes are applied content-text, right-align and bold-font. I need to select this div, but problem is that classes are applied in different order on different pages

<div class="content-text right-align bold-font">...</div>
<div class="right-align content-text bold-font">...</div>
<div class="content-text bold-font rig开发者_运维问答ht-align ">...</div>
...

How can I select this particular div, no matter how classes are applied?

Thanks


This will work fine. CSS selectors in general don't care about the order of classes, just the ones that are applied. This also goes for jQuery:

$('div.content-text.right-align.bold-font');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜