Latest web development tutorials

jQuery .class selector

jQuery selector jQuery selector

Examples

Select the class of "intro" all the elements:

$(".intro")

try it"

Definition and Usage

.class selector selects all elements with the specified class.

class reference class attribute of the HTML element.

class attribute is used to set a specific style for multiple HTML elements.

Note: Do not use the number at the beginning of the class attribute!It may be a problem in some browsers.


grammar

$(".class")

参数 描述
class 必需。规定要选取的元素的 class。


Examples

Try - Example

Select the class of "intro" all the elements p
How to select the class of "intro" all p elements.


jQuery selector jQuery selector