Reputation: 1430
I have to set focus on the last row second column while clicking add new row button.
row append code:
$("#tblDetItems").append('<tr><td align="right">' + sl_no + '</td><td td style="width: 200px; height: 13px;"><input type="text" id="txtCode" value="" style="width: 190px; height: 13px;" /></td><td>' + "" + '</td><td>' + "" + '</td><td align="right" style="width: 100px; height: 13px;"><input type="text" id="txtStdRate" value="0.00" style="width: 100px; height: 13px;" /></td><td align="right" style="width: 100px; height: 13px;"><input type="text" id="txtLbrCharge" value="0.00" style="width: 100px; height: 13px;" /></td><td align="right" style="width: 100px; height: 13px;"><input type="text" id="txtRcvryCost" value"0.00" style="width: 100px; height: 13px;" /></td><td style="width:80px; height: 18px;"><select id="cmbUseId_tbl" style="width: 80px; height: 18px;"><option value="Y" selected="selected">Yes</option><option value="N">No</option></select></td></tr>');
Upvotes: 0
Views: 2575
Reputation: 417
you can give any selector to every textbox you create i.e. class name.
<input type="text" class="fooClass" value="" />
then use jQuery last keyword to make it focus after generating last row.
$( ".fooClass:last" ).focus();
Upvotes: 2