57 of 119 menu

The last method

The last method selects the last element among those already found.

Syntax

.last();

Example

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

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

HTML the code will look like this:

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

See also

  • method first,
    which receives the first element
  • method eq,
    which gets c element with a certain 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