jQuery - Multiple Elements Selector
This Multiple Elements selector selects the combined results of all the specified selectors E, F or G.
You can specify any number of selectors to combine into a single result. Here order of the DOM elements in the jQuery object aren't necessarily identical.
Here is the simple syntax to use this selector −
$('E, F, G,....')
Here is the description of all the parameters used by this selector −
E − Any valid selector
F − Any valid selector
G − Any valid selector
Like any other jQuery selector, this selector also returns an array filled with the found elements.
$('div, p') − selects all the elements matched by div or p.
$('p strong, .myclass') − selects all elements matched by strong that are descendants of an element matched by p as well as all elements that have a class of myclass.
$('p strong, #myid') − selects a single elements matched by strong that is descendant of an element matched by p as well as element whose id is myid.
Following example would select elements with class ID big and element with ID div3 and will apply yellow color to its background −Live Demo
This will produce following result −