Ketan Borada
Ketan Borada

Reputation: 864

JQuery foreach with not

I want to use jQuery for each with not rendering element how can I do that

$.each($('.single-price .price'), function(){...}

but not render this element

 $.not($('.single-price .special .price'), function(){...}

in only one for loop

Upvotes: 0

Views: 556

Answers (2)

Mario Cianciolo
Mario Cianciolo

Reputation: 1261

Select elements first, then pass them to each:

$('.single-price :not(.special .price) .price').each(function() {
    // ... your code here
})

Upvotes: 3

Karan Batra
Karan Batra

Reputation: 106

You can Use .stop() in between .each(); $('.single-price .special .price').stop();

Upvotes: 0

Related Questions