i have a table whose structure is
<table>
<tr>
<td>
<input type="text" id="field_1" />
<input type="text" id="field_2" />
</td>
</tr>
<tr>
<td>
<input type="text" id="field_1" />
<input type="text" id="field_2" />
</td>
</tr>
<tr>
<td>
<input type="text" id="field_1" />
<input type="text" id="field_2" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
i like to loop through all the tr and check if field_1 and field_2 are empty .
My sample code
$('#table-1 tr').each(function () {
var title = $(this).find("input[id*='field_1']");
var link = $(this).find("input[id*='field_2']");
if (title.value == '' || link.value == '') {
alert("empty");
}
});
This gives undefined for both link and title !!