I am trying to select every first child of any parent with the class .Payment
Sample HTML :
<div class='payment'>
<input id="payments_0_:date_paid" name="payments[0][:date_paid]" type="text" />
<br>
<input id="payments_0_:amount_paid" name="payments[0][:amount_paid]" type="text" />
</div>
<div class='payment'>
<input id="payments_1_:date_paid" name="payments[0][:date_paid]" type="text" />
<br>
<input id="payments_1_:amount_paid" name="payments[0][:amount_paid]" type="text" />
</div>
<div class='payment'>
<input id="payments_2_:date_paid" name="payments[0][:date_paid]" type="text" />
<br>
<input id="payments_2_:amount_paid" name="payments[0][:amount_paid]" type="text" />
</div>
How can I iterate through each .payment and validate whether the first child in each is under a certain quality?
This is my attempt :
$.each($(".payment"), function(key, value) {
alert( $("value input:first").val() );
});
But the trouble I am having here is using the var value
in getting that attribute value()
Any ideas?