I am trying to get the value of the input than check whether it has changed, by default, the value is 1. When changed,inputted or incremented using the arrow keys, it will trigger the change listener. So far, it does not trigger when I change the value from the default.
Code for the row I want to extract the input value from.
<tr class="deleteRow">
<th scope="row">
<button type="button" class="btn btn-danger btn-sm">
<i class="fas fa-trash"></i>
</button>
</th>
<td>Item 1</td>
<td>
<input class="form-control" type="number" value="1" />
</td>
<td>RM 50.00</td>
</tr>
My function code so far:
<script>
$('.form-control').change(function(){
alert("this doesn't fire help!");
});
</script>
Any advice?
EDIT: Some extra information, the row is added dynamically with a button. I checked the other buttons for the row, they work. They all use on('click') except the number input which I'm working on.
EDIT EDIT: So it doesn't work on rows added after the page is loaded. If the rows were added after programmatically, the listener doesn't work.