Multiple Selector ("selector1, selector2, selectorN")

Selects the combined results of all the specified selectors.

.multiple(selector1, selector2, selectorN)

selector1 SelectorAny valid selector.
selector2 SelectorAnother valid selector.
selectorN SelectorAs many more valid selectors as you like.

You can specify any number of selectors to combine into a single result. This multiple expression combinator is an efficient way to select disparate elements. The order of the DOM elements in the returned jQuery object may not be identical, as they will be in document order. An alternative to this combinator is the .add() method.

Finds the elements that match any of these three selectors.

JS
<div>div</div>
<p class="myClass">p class="myClass"</p>
<p class="notMyClass">p class="notMyClass"</p>
<span>span</span>
CSS
div,
span,
p {
  width: 126px;
  height: 60px;
  float: left;
  padding: 3px;
  margin: 2px;
  background-color: #eee;
  font-size: 14px;
}
HTML
$("div, span, p.myClass").css("border", "3px solid red");
DEMO

Show the order in the jQuery object.

JS
<span>span</span>
<p>p</p>
<p>p</p>
<div>div</div>
<span>span</span>
<p>p</p>
<div>div</div>
<b></b>
CSS
b {
  color: red;
  font-size: 16px;
  display: block;
  clear: left;
}
div,
span,
p {
  width: 40px;
  height: 40px;
  float: left;
  margin: 10px;
  background-color: blue;
  padding: 3px;
  color: white;
}
HTML
var list = $("div, p, span")
  .map(function () {
    return this.tagName;
  })
  .get()
  .join(", ");
$("b").append(document.createTextNode(list));
DEMO

Looking for a Web Developer?

👋

Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)