Multiple ('selector1, selector2, selectorn')S2C Home « Selectors « Multiple ('selector1, selector2, selectorn')

Multiple selector.

Shorthand version  $('selector1, selector2, selectorn')

Description

The ('selector1, selector2, selectorn') selector, selects all elements that match any of the specified selectors.

Syntax


Signature Description
jQuery('selector1, selector2, selectorn')Multiple match

Parameters

Parameter Description
selector1A valid selector.
selector2Another valid selector.
selectornAs many more valid selectors as required.

Return

N/A.

Multiple ('selector1, selector2, selectorn') ExampleTop

Selects all elements that match any of the specified selectors.

The following example will select all 'p' and 'input' nodes and turn the background colour yellow.


$(function(){
  $('#btn14').on('click', function() {
    $('p, input').css('backgroundColor', 'yellow');
  });
}); 

Press the button below to action the above code: