Example

Select elements with class "intro":

$(".intro")

Try it yourself »

Definition and Usage

The . selector selects elements with a specific class.

The class refers to the class attribute of a HTML element.

Unlike the id attribute, the class attribute is most often used on several elements.

This allows you to set a particular style for any HTML elements with the same class.

Syntax

$(".class")

Parameter Description
class Required. Specifies the class of the elements to select.
The class selector uses the class attribute of the HTML element


Tips and Notes

Note: Do not start a class name with a number. It may cause problems in some browsers.