Huma Ali
Huma Ali

Reputation: 1809

Get element with specific class

I have several divs in my variable offers and I want to retrieve the one with class special. How can I find that element? Or apply selector on variable offers?

For Example offers contain:

<div class="special">A</div>
<div class="notspecial">B</div>
<div class="notspecial">C</div>
<div class="special">D</div>

Upvotes: 1

Views: 61

Answers (1)

Milind Anantwar
Milind Anantwar

Reputation: 82251

You can use .filter() function to filter out elements based on condition in returned set:

var splofferelements = offers.filter('.special')

Upvotes: 2

Related Questions