How to set the value to the nested table's field? My table show in below:
<table id="first">
<tr>
<td><input type="text" id="type[0]" name="type[0]"/></td>
<td>
<table>
<tr class="list"><td><input type="text" id="type[0].a[0].label" name="type[0].a[0].label"/></td></tr>
<tr class="list"><td><input type="text" id="type[0].a[1].label" name="type[0].a[1].label"/></td></tr>
</table>
</td>
</tr>
<table>
I am trying to use find and input[] to set the value, but its failed to do so.
$("#first").find("table").find("tr:last").find('input[name="type['+i+'].a['+j+'].label"]').val("ABC");
But able to set the first table by using .find.
$("#first > tbody > tr:last").find('input[name="type['+i+'].a['+j+']"]').val("123");
Unable to get by using jquery find by class:
tr.list
I tried this as well, prompt undefined
alert($("#first table:last > tr.list").attr("id"));
My questions are:
- How to find the nested table?
- How to set the value to nested table?
- How to set value to the nested table either single or in arraylist?