jQuery eq() Yöntemi
Örnek
İkinci <p> öğesini seçin (dizin numarası 1):
$("p").eq(1).css("background-color", "yellow");
Tanım ve Kullanım
eq() yöntemi, seçili öğelerin belirli bir dizin numarasına sahip bir öğe döndürür.
Dizin numaraları 0'dan başlar, bu nedenle ilk öğenin dizin numarası 0 olur (1 değil).
Sözdizimi
$(selector).eq(index)
Parameter | Description |
---|---|
index | Required. Specifies the index of the element. Can either be a positive or negative number. Note: Using a negative number will start the index count from the end of the selected elements, instead of the beginning. |
Kendiniz Deneyin - Örnekler
kullanma Seçili öğelerin sonundan ikinci <p> öğesini döndürmek için negatif bir sayı kullanma.