56 of 119 menu

Method first

The first method selects the first element found.

Syntax

.first();

Example

Let's find all the paragraphs, then select the first one from those found and assign it the text '!':

<p>text</p> <p>text</p> <p>text</p> $('p').first().text('!');

HTML the code will look like this:

<p>!</p> <p>text</p> <p>text</p>

See also

  • method last,
    which receives the last element
  • method eq,
    which gets the element with a specific number
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