⊗jqSeEM 74 of 113 menu

jQuery eq method

To select a specific number in a set, there is a method eq. The number of an element in a set can be either positive or negative. In the second case, the count is from the end, -1 will be the last element, -2 - the penultimate, and so on:

Let's look at an example where the following paragraphs are written in the HTML code:

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

Let's find all the paragraphs, and then color the third one (numbered 2, since the numbering starts from zero) red:

$('p').eq(2).css('color', 'red');

Find the fifth li in the set and color it green.

Find the second to last li in the set and color it red.

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