It is possible to select multiple elements by using jQuery Selector. As we know already, the wildcard * selector selects all elements in the document. The jQuery allows selecting multiple elements as user wants to select in the document. We can specify any number of elements separated with a comma which combines all the elements and display as single result.
JQuery Multiple Selector Syntax
It contains number of elements which combines all the elements in the document and display into single result.
JQuery Multiple Selector Example
<title>JQuery multpile elements Selection</title>
<h2>JQuery multpile elements Selection Example</h2>
<h4>It is also called universal selector…</h4>
<h5>It is easy to learn.</h5>
- $(“h3,h4,span,div”).css(“border-style”, “double”); statement defines multiple elements such as h3, h4, span and div elements. It uses CSS border property which specifies what kind of border to display. Here it will display the two borders as specified in the border style value.
When you run the above example, you would get the following output: