electricalbah
electricalbah

Reputation: 2297

Multiple Selector like statement

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

Upvotes: 1

Views: 64

Answers (2)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167192

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.

Upvotes: 5

Tushar
Tushar

Reputation: 87203

This selector is called context selector.

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

DOCS

Upvotes: 3

Related Questions