I have this table and I have to traverse using Jquery
:
<table id="answer">
<thead>
<tr class="grdheader">
<td><input type="checkbox" style="border:0px"id="a1chkAll"></td>
<td>Free Text</td>
<td>Weighting</td>
</tr>
</thead>
<tbody>
<tr id="tdata">
<td><input type="checkbox" value="440" id="achk" checked="checked"></td>
<td>ABC</td>
<td>2</td>
</tr>
<tr id="tdata">
<td><input type="checkbox" value="440" id="achk" checked="checked"></td>
<td>PQR</td>
<td>4</td>
</tr>
<tr id="tdata">
<td><input type="checkbox" value="440" id="achk"></td>
<td>LMN</td>
<td>6</td>
</tr>
</tbody>
Get Array
like this for it respective Checkbox
is checked.
Array(
'<tr id="tdata">
<td><input type="checkbox" value="440" id="achk"></td>
<td><input type="textbox" value="ABC"></td>
<td><input type="textbox" value="2"></td>
</tr>',
'<tr id="tdata">
<td><input type="checkbox" value="440" id="achk"></td>
<td><input type="textbox" value="PQR"></td>
<td><input type="textbox" value="4"></td>
</tr>'
)
You can use jQuery .find and .child functions, you can also check a possible similar question here, may also help.