I am trying to load html file containing same table elements like my default table when I click on add more button. When I click Add more button it loads the file one time but don't work when I click the button second time. Here is my table section of default page :
<div class="form_container">
<form method="POST" action="actionPage.php">
<div class="table_container">
<table border="2">
<tr>
<tr>
<td><label>Sr.No :</label></td>
<td><input type = "number" class="SrNo" name="SrNo" value="1" readonly></td>
<td><label>Design number :</label></td>
<td><input type="text" class="designNo" name="designNumber"></td>
</tr>
<tr>
<td><label>Fabric quality :</label></td>
<td><select name="fabricSelect">
<option value="Fabric1" name="fabric1">Fabric1</option>
<option value="Fabric2" name="fabric2">Fabric2</option>
<option value="Fabric3" name="fabric3">Fabric3</option>
<option value="Fabric4" name="fabric4">Fabric4</option>
</select>
<td><label>Color matching :</label></td>
<td><input type="select" class="colorMatch" name="colorMatch"></td>
</tr>
<tr>
<td><label>Quantity :</label></td>
<td><input type="number" class="quantity" name="quantity"></td>
<td><label>Printing type :</label></td>
<td><select name="printSelect">
<option value="Print1">Print1</option>
<option value="Print2">Print2</option>
<option value="Print3">Print3</option>
<option value="Print4">Print4</option>
</select>
</td>
</tr>
<tr>
<td ><label>Rate :</label></td>
<td colspan="2"><input type="number" name="rate"></td>
</tr>
<tr class="newForm">
</tr>
</tr>
</table>
<input type="submit" id="submit_btn" class="class_btn">
</div>
</form>
<button class="addButton">Add more tab</button>
</div>
This is my script :
<script>
$(document).ready(function() {
var flag = 0;
$(".addButton").click(function(e) {
if(flag != 5) {
flag += 1;
$(".newForm").load("addedForm.php");
}
else {
e.preventDefault();
}
});
})
</script>
And here is my other file that I want to load :
<tr>
<td><label>Sr.No :</label></td>
<td><input type = "number" class="SrNo" value="" readonly></td>
<td><label>Design Number:</label></td>
<td><input type="text" class="designNo"></td>