I have the following
<div class="d1" id="div1">
<input type="text" class="t1">
<input type="text" class="t1">
<input type="text" class="t1">
<input type="text" class="t1">
</div>
<div class="d1" id="div2">
<input type="text" class="t1">
<input type="text" class="t1">
<input type="text" class="t1">
<input type="text" class="t1">
</div>
What I want to do is go through all the textboxes in order to change the class to the empty spaces and also the class to the div that has empty textboxes ...
try this:
var inputs = $("#div1 > input");
// una vez tenemos el array, podemos iterar
for (var i = 0; i < inputs.length; i++) {
var in = inputs[i].val();
if (in.length > 0) {
// no está vacío
}
}
but it does not work ... any advice?
thank you very much!