1

I know what a multiple selector does

$( "p , #test" )

It gives the combined results of all the specified selectors and I can find some documentation for it.

But I found this piece of syntax somewhere and I dont know how its called and cant find a way to explain it. Can anyone tell me the name and where I can find some documentaion

$( "p" , "#test" )

it seems to get all p elements only within the element with id=test

Tushar
  • 85,780
  • 21
  • 159
  • 179
electricalbah
  • 2,227
  • 2
  • 22
  • 36
  • similar issue here: http://stackoverflow.com/questions/8092500/comma-separated-list-of-selectors – n-dru Jun 29 '15 at 14:34

2 Answers2

5

The $ selector's second parameter is the context.

A DOM Element, Document, or jQuery to use as context. Accepts a string containing a CSS selector which is then used to match a set of elements.

Have a look at the Docs.

Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
3

This selector is called context selector.

Accepts a string containing a CSS selector which is then used to match a set of elements.

DOCS

Tushar
  • 85,780
  • 21
  • 159
  • 179