jQuery Misc her() Yöntem

❮ jQuery Çeşitli Yöntemleri

Örnek

Her <li> öğesinin metnini uyarın:

$("button").click(function(){
  $("li").each(function(){
    alert($(this).text())
  });
});

Tanım ve Kullanım

Her() yöntemi, eşleşen her öğe için çalıştırılacak bir işlevi belirtir.

İpucu: Döngüyü erken durdurmak için false döndürmek kullanılabilir.


Sözdizimi

$(selector).each(function(index,element))

Parameter Description
function(index,element) Required. A function to run for each matched element.
  • index - The index position of the selector
  • element - The current element (the "this" selector can also be used)

❮ jQuery Çeşitli Yöntemleri