jQuery multiple elements Selector (original) (raw)
Last Updated : 17 Nov, 2022
The jQuery multiple elements Selector is used to select multiple elements of an HTML document.
Syntax:
$("element1, element2, element3, ...")
Parameter:
- element: This parameter is required to specify the elements to be selected.
Example 1: In this example, we will select the multiple elements by using jQuery multiple elements Selector.
HTML `
<script>
$(document).ready(function () {
$("h2, div, span").css(
"background-color", "green");
});
</script>
Welcome to GeeksforGeeks
Geeks1
Geeks2
Geeks3
Geeks4
`
Output:
Example 2: In this example, we will select all the elements by using * selector.
HTML `
<script>
$(document).ready(function () {
$("*").css(
"background-color", "green");
});
</script>
Welcome to GeeksforGeeks
Geeks1
Geeks2
Geeks3
Geeks4
`
Output: