I have created a j query script to allow me to clone the last row of a table however i would like 2 of the columns to be empty on the clone. I am only able totally empty one of the fields any help on this would be greatly appreciated.
html for the table:
<tbody>
<tr>
<td><input id="wInv_work_Id0" name="wInv_work_Id0" type="text" readonly="true" value="<%=rswork2.getString(1)%>"></td>
<td><select id="invTru_Type0" name="invTru_Type0" onchange="getTruckPlates(this.value, this.id)">
<option disabled selected hidden value="">Select A Truck Type</option>
<%while(rsinvTru1.next()){%>
<option><%=rsinvTru1.getString(1)%></option>
<%}%>
</select> </td>
<td><select class="selectLp" id="invTru_LicensePlateNo0" name="invTru_LicensePlateNo0" >
<option disabled selected hidden value="">Select A Truck</option>
</select></td>
<td><select id="driver_emp_Id0" name="driver_emp_Id" >
<option disabled selected hidden value=""></option>
</select></td>
<!--<td><input id="driver_emp_Id0" name="driver_emp_Id0" value=" " readonly="true" type="text"></td>-->
<td><input id="wInv_JobNo0" name="wInv_JobNo0" type="text"></td>
</tr>
</tbody>
j query that allows clone
$(document).ready(function () {
$("#btn_AddTruck").click(function () {
var $tableBody = $('#tbl_invTruck').find("tbody"),
$trLast = $tableBody.find("tr:last"),
$trNew = $trLast.clone();
// Find by attribute 'id'
$trNew.find('[id]').each(function () {
var num = this.id.replace(/\D/g, '');
if (!num) {
num = 0;
}
// Remove numbers by first regexp
this.id = this.id.replace(/\d/g, '')
// increment number
+ (1 + parseInt(num, 10));
});
$trLast.after($trNew);
$trNew.find('select').val('');
});
});
I would like that on clone the driver_emp_Id0 and wInv_JobNo0 values be set to empty.Please note that the ids of the clones are being incremented by 1 on the clone