jQuery class Selector

Last Updated Jul 21, 2015, 12:00:06 PM





jQuery class Selector

jQuery class selector is used to find all the elements which has same class name.

Remember a class name what you initially give to yourHTML elements.

The jQuery class selector is can be called using . (DOT) operator followed by the class name

Syntax Example
HTML

In the above HTML code each div element has a different class name as class-one, class-two, class-three. So what we can do is, we can simply target those three classes and apply the styles like below

jQuery

If you run the above jQuery class example code, it will apply the green color to the class-one HTML div element, blue color to class-two div element and finally, red color to class-three span elemement

Output
jquery class selector
Try It Now

Other Advanced jQuery Selectors you might want to learn


jQuery Complete Selectors Reference

jQuery Selectors

jQuery Basic Selectors

jQuery Child Selectors

jQuery Content Filter Selectors


Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 21, 2015, 12:00:06 PM