Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the next after comma in $('.elem',elem)?

I'm using code like $('.elem',elem), $('.elem',elem).tabs().

$(".elem") is used to select elements with that class.

But what is the next after comma? What is the use of it?

like image 817
Natesan Avatar asked Jun 06 '13 08:06

Natesan


People also ask

Do you need a comma after “next”?

“Next” is one of those tricky words! Do you need a comma after “next” in a sentence? You need a comma after “next” when it is used as an introductory word/phrase at the start of a sentence/clause. Used in this way, “next” is an adverb. “Next” as an adverb may also occur later in the sentence when the sentence contains a compound direct object.

Do you put a comma at the beginning of a sentence?

A comma normally follows participial phrases that introduce a sentence: Grabbing her umbrella, Kate raced out of the house. Confused by her sister’s sudden change in mood, Jill stayed quiet. When an adverbial phrase begins a sentence, it’s often followed by a comma but it doesn’t have to be, especially if it’s short.

Do you follow a transition word with a comma?

If you introduce a sentence with a transition word (e.g. however, hence , indeed, furthermore ), follow it with a comma. However the model is not always accurate. However, the model is not always accurate.

Do you put commas in introductory prepositional phrases?

When an introductory prepositional phrase is very short (less than four words), the comma is usually optional. But if the phrase is longer than four words, use a comma. Consider the below examples of sentences containing properly placed and omitted commas: Before the movie let’s get some popcorn.


2 Answers

$('.elem',elem) is $(elem).find('.elem'). In fact, that's what jQuery does with it under the covers. It finds all elements with class "elem" that are descendants of the elem element.

This is covered in the API documentation. It's well worth spending an hour just reading that from beginning to end. There are all sorts of useful things in there that aren't well known. :-) (I'm not saying this is one of them [I'm not a fan of it myself, some folks are], just that generally there are lots of useful things in there.)

like image 141
T.J. Crowder Avatar answered Nov 06 '22 23:11

T.J. Crowder


This is the context into which the search is done.

It's the same than

$(elem).find('.elem')

See documentation here

like image 43
Denys Séguret Avatar answered Nov 06 '22 22:11

Denys Séguret