jQuery – this + class

Problem: Trebamo selektirati sve elementa #polje unutar svakog  elementa klase .stavka koristeći this:

Ovo nam neće pomoći jer je pogrešno:

$(".stavka").each(function(){
 return $("this #polje").val();
});

Rješenje je $(this).find():

$(".stavka").each(function(){
 return $(this).find("#polje").val();
 });

Comments are closed.