I am trying to develop a form where user submits:
- Item
- Quantity
The form also has 2 buttons:
ADD ITEM and REMOVE ITEM
The thing is upon ADD ITEM click, form appends new row(that works yay), but I want ADD ITEM button to go hidden as item gets added below is the html & jQuery code, i tried to get it hidden with. then but no luck lol
please advise
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
var i = 1;
$('#add-item').click(function() {
i++;
$('#table-fields')
.append('<tr id="row'+i+'"><td><input type="text"/></td><td><input/></td><td><button>ADD</button></td><td><button id="'+i+'">REMOVE</button></td></tr>');
});
}
);
</script>
</head>
<body>
<form id="items-to-move">
<table id="table-fields">
<tr>
<td><input/></td>
<td><input/></td>
<td><button type="button" id="add-item">ADD</button></td>
<td><button id="remove-item">REMOVE</button></td>
</tr>
</table>
</form>
</body>
</html>