67 of 119 menu

The get method

The get method gets a set of elements corresponding to a jQuery object.

Syntax

This is how we get the entire set of elements as an array:

.get();

You can specify a specific number of an element in a set and get it. The number can also have a negative value (then the count is made backwards from the last element):

.get(number);

Example

Let's get the second paragraph using the get method, counting from 0:

<p>text</p> <p class="aaa">text</p> <p>text</p> <p>text</p> alert( $('p').get(1) );

See also

  • method find,
    which searches for elements within those already found
  • method filter,
    which filters the elements in a set
English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline