English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Specify the class name of the element to be selected
Said .class The selector selects all elements with the specified class.
It is declared before a string of one or more characters with a dot (.)
class属性用于为多个HTML元素设置特定样式。
The class attribute is used to set specific styles for multiple HTML elements.
HTML elements can also refer to multiple classes (see the example below).Note:
Syntax:
$(".class")
Example Select all elements with the class "demo":-$(".myclass.otherclass").css("background color", "yellow");});/Test See‹
$(".demo").css("background
Example Select all <p> elements with the class "demo":-$(".myclass.otherclass").css("background color", "yellow");});/Test See‹
$("p.demo").css("background
Example $("document").ready(function(){-$(".myclass.otherclass").css("background color", "yellow");});/Test See‹
Parameter Value | Parameters |
---|---|
Description | class |