adsense

Saturday, April 17, 2021

select all elements of a class, except one element

If we want to do some action on selected list of elements except one element in the list we can use jQuery as shown below.

 $(".parentElement:not(#childId)").actionName();

If you want to skip multiple elements

 $(".parentElement:not(#childId1,#childId2)").actionName();

Or you can use not()

$(".parentElement").not("#childId1").actionName();


Cheers,

Samitha

 

No comments:

Post a Comment