Пуховики add

Поделитесь в социальных сетях:vKontakteFacebookTwitter

.add selector Returns jQuery

Description: Create a new jQuery object with elements added to the set of matched elements.

  • selector
    Type: Selector

    A string representing a selector expression to find additional elements to add to the set of matched elements.

  • elements
    Type: Element

    One or more elements to add to the set of matched elements.

  • An HTML fragment to add to the set of matched elements.

  • An existing jQuery object to add to the set of matched elements.

    • selector
      Type:

      A string representing a selector expression to find additional elements to add to the set of matched elements.

    • context
      Type:

      The point in the document at which the selector should begin matching; similar to the context argument of the method.

Given a jQuery object that represents a set of DOM elements, the method constructs a new jQuery object from the union of those elements and the ones passed into the method. The argument to can be pretty much anything that accepts, including a jQuery selector expression, references to DOM elements, or an HTML snippet.

Do not assume that this method appends the elements to the existing collection in the order they are passed to the method. When all elements are members of the same document, the resulting collection from will be sorted in document order; that is, in order of each element’s appearance in the document. If the collection consists of elements from different documents or ones not in any document, the sort order is undefined. To create a jQuery object with elements in a well-defined order and without sorting overhead, use the signature.

The updated set of elements can be used in a following (chained) method, or assigned to a variable for later use. For example:

1

2

The following will not save the added elements, because the method creates a new set and leaves the original set in pdiv unchanged:

1

2

Consider a page with a simple list and a paragraph following it:

1

2

3

4

5

6

We can select the list items and then the paragraph by using either a selector or a reference to the DOM element itself as the method’s argument:

1

Or:

1

2

The result of this call is a red background behind all four elements.
Using an HTML snippet as the method’s argument (as in the third version), we can create additional elements on the fly and add those elements to the matched set of elements. Let’s say, for example, that we want to alter the background of the list items along with a newly created paragraph:

1

2

Although the new paragraph has been created and its background color changed, it still does not appear on the page. To place it on the page, we could add one of the insertion methods to the chain.

As of jQuery 1.4 the results from .add() will always be returned in document order (rather than a simple concatenation).

Note: To reverse the you can use to remove elements from the jQuery results, or to return to the selection before you added.

Adds more elements, matched by the given expression, to the set of matched elements.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

Adds more elements, created on the fly, to the set of matched elements.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

Adds one or more Elements to the set of matched elements.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

Demonstrates how to add (or push) elements to an existing collection

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

.add selector Возвращает jQuery

Описание: Добавляет заданные элементы в уже существующий набор элементов.

  • selector
    Тип: Selector

    A string representing a selector expression to find additional elements to add to the set of matched elements.

  • elements
    Тип: Element

    One or more elements to add to the set of matched elements.

  • An HTML fragment to add to the set of matched elements.

  • An existing jQuery object to add to the set of matched elements.

  • Добавлен в версии: 1.4

    • selector
      Тип:

      A string representing a selector expression to find additional elements to add to the set of matched elements.

    • context
      Тип:

      The point in the document at which the selector should begin matching; similar to the context argument of the method.

Given a jQuery object that represents a set of DOM elements, the method constructs a new jQuery object from the union of those elements and the ones passed into the method. The argument to can be pretty much anything that accepts, including a jQuery selector expression, references to DOM elements, or an HTML snippet.

Do not assume that this method appends the elements to the existing collection in the order they are passed to the method. When all elements are members of the same document, the resulting collection from will be sorted in document order; that is, in order of each element’s appearance in the document. If the collection consists of elements from different documents or ones not in any document, the sort order is undefined. To create a jQuery object with elements in a well-defined order and without sorting overhead, use the signature.

The updated set of elements can be used in a following (chained) method, or assigned to a variable for later use. For example:

1

2

The following will not save the added elements, because the method creates a new set and leaves the original set in pdiv unchanged:

1

2

Consider a page with a simple list and a paragraph following it:

1

2

3

4

5

6

We can select the list items and then the paragraph by using either a selector or a reference to the DOM element itself as the method’s argument:

1

Or:

1

2

The result of this call is a red background behind all four elements.
Using an HTML snippet as the method’s argument (as in the third version), we can create additional elements on the fly and add those elements to the matched set of elements. Let’s say, for example, that we want to alter the background of the list items along with a newly created paragraph:

1

2

Although the new paragraph has been created and its background color changed, it still does not appear on the page. To place it on the page, we could add one of the insertion methods to the chain.

As of jQuery 1.4 the results from .add() will always be returned in document order (rather than a simple concatenation).

Note: To reverse the you can use to remove elements from the jQuery results, or to return to the selection before you added.

Предложения

Tom added some interesting spices to the stew.Фома добавил немного необычных специй в рагу.

I didn’t add this sentence.Я не добавлял это предложение.

Let me add a few words before you seal the letter.Дайте мне добавить несколько слов, прежде чем запечатаете письмо.

Add the rice and cook gently until the grains begin to turn translucent.Добавьте рис и готовьте на слабом огне, пока зёрна не начнут становиться полупрозрачными.

I have nothing to add on my part.Мне нечего добавить.

Maybe I should add some sentences without translations too. It’s a very quick way to improve the rating of your language.Может, и мне подобавлять предложений без перевода? Так можно очень быстро поднять рейтинг своего языка.

Now I’ll add the finishing touch.Сейчас я внесу последний штрих.

I add sentences.Я добавляю предложения.

Let’s find sentences with new vocabulary on this topic, add them to the following list: _____; and translate them.Давайте будем находить фразы с новыми словами по этой теме, добавлять их в список “_____” и переводить.

Add salt to taste.Добавьте соль по вкусу.

You can add sentences you don’t know how to translate.Вы можете добавить предложения, которые вы не знаете, как перевести.

That adds a new dimension to our problem.Это добавляет к нашей проблеме новое измерение.

HTTP 2 just adds a new layer of complexity without solving any real-world problems.HTTP 2 только добавляет новый уровень сложности, не решая никаких действительно важных проблем.

She always adds new information in her translations.Она всегда добавляет новую информацию в своих переводах.

I often quote myself, it adds spice to the conversation.Я часто цитирую самого себя, это добавляет пикантность разговору.

It only adds fuel to the fire.Это только подливает масла в огонь.

His opinion adds a new light to the question.Его мнение проливает новый свет на проблему.

He always adds new information in his translations.Он всегда добавляет новую информацию в своих переводах.

Don’t shout at the crying child. It only adds fuel to the fire.Не кричите на плачущего ребёнка. Этим вы только подливаете масла в огонь.

She adds a lot of examples.Она добавляет множество примеров.

I’ve added an alternative sentence and I’ve tagged it as ‘old fashioned’. What more do you want, blood?Я добавил другое предложение и пометил его как “старомодное”. Чего же ещё вам надо, крови?

Is it true that you added a million examples to Tatoeba?А правда, что ты добавил на Татоэбу миллион примеров?

He added that he didn’t believe it.Он добавил, что не верит в это.

It seemed the quarrel would finally be talked out, when Mark added fuel to the fire by bringing up the question of who was guilty.Казалось, дело дойдёт до ссоры, когда Марк подлил масла в огонь, подняв вопрос о том, кто виноват.

It should be added that his remarks had no direct influence on the constituency.Следует добавить, что его реплики не имели прямого влияния на электорат.

Sentences are being added to Tatoeba at a phenomenal rate.Предложения добавляются на Татоэбу с феноменальной скоростью.

We have added greater 64-bit server support.Мы добавили большую поддержку для 64-разрядных серверов.

Tom added more wood to the fire.Фома подбросил дровишек в костёр.

You have added a comment, not a translation. To add a translation, click on the «あ→а» icon above the sentence.Вы добавили комментарий, а не перевод. Чтобы добавить перевод, щёлкните по значку «あ→а» над предложением.

Поделитесь в социальных сетях:vKontakteFacebookTwitter
Напишите комментарий