English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
You can select multiple selectors as needed. Just separate selectors with commas.
Multiple selectors select the combined result of all specified selectors.
This is very useful when you want to perform the same operation on different selectors.
$("selector1, selector2, selectorN)
Select each<p>and<h4>elements:</div>
$ (document).ready(function() { $("p, .h4").css("background-color", "lightgreen"); });Test See‹/›
Select each<h2>,<div>and<span>elements:</div>
$ (document).ready(function() { $("h2, div, span").css("background-color", "lightgreen"); });Test See‹/›
Select all elements with the multiple class names "demo" or "para":
$ (document).ready(function() { $(".demo, .para").css("background-color", "lightgreen"); });Test See‹/›
Parameter | Description |
---|---|
selector1, selector2,selectorN | Specify the selector to be chosen |