Post your trick

jQuery: selecting elements with multiple classes

Here is a way to select element with multiple classes in jquery.

$(’table.cl1.cl2′).addClass(’abc’);

And to select the element which has one class
but not the other. This, does that:

$(’table.cl1:not(table.cl2)’).addClass(’xyz’);

Second one is pretty interesting which works like if clause.


Leave a Reply

     

     

     

Post A Trick !

How does "Kodetricks" work?

We at kodeplay like to share knowledge. With Kodetricks, even you can join us. All you need to do is post a programming related trick if you have one or rate a trick if you like someone else's.



Technology

Contact Us