jQuery . Selector

Example

Select elements with class="intro":

$(".intro")

Try It Yourself

Definition and Usage

. selector selects elements with the specified class.

The class selector refers to the class attribute of HTML elements.

Unlike ID selectors, class selectors are often used for multiple elements.

This allows you to set specific styles for any HTML element with the same class.

Syntax

$(".class)
Parameters Description
class

Required. Specifies the class of the element to be selected.

The class selector uses the class attribute of HTML elements.

Tips and Notes

Note:Do not use class names starting with numbers! It may cause problems in some browsers.