I have a html in the format of tr td .Now i want to get the html of tr whose id is table_structure.And i want to get the very specific html of the id.I want to get the last 3 td html by using jquery .How can we get this .Please help me
HTML :
<table id="chargeshtml" style ="display:none">
<tr class="inputstr">
<td style="font-size:12px">Code</td>
<td>
<input type="text" id="code" name="code" value=""/>
</td>
<td style="font-size:12px">Charges </td>
<td>
<input type="text" id="charges_id" name="charges" value=""/>
</td>
<td style="font-size:12px">Adt Charges </td>
<td>
<input type="text" id="adt_charges" name="adt_charges" value=""/>
</td>
<td style="font-size:12px">Chd Charges </td>
<td>
<input type="text" id="chd_charges" name="chd_charges" value=""/>
</td>
</tr>
<tr class="chktr">
<td>
<input type="checkbox" name="chk" id="chk" value="Checked" >Cheked </br>
</td>
</tr>
</table>
On the click of chk i want to get the this HTML from te above
<td style="font-size:12px">Charges </td>
<td>
<input type="text" id="charges_id" name="charges" value=""/>
</td>
<td style="font-size:12px">Adt Charges </td>
<td>
<input type="text" id="adt_charges" name="adt_charges" value=""/>
</td>
<td style="font-size:12px">Chd Charges </td>
<td>
<input type="text" id="chd_charges" name="chd_charges" value=""/>
</td>
$('#table_structure').prop('outerHTML')
$('#table_structure td').slice(-3).map(function () { return this.outerHTML; }).get().join('')