Get last textbox value added dynamically and append that textbox value to next textbox:
$('#myTable').on('click', 'input[type="button"]', function() {
$(this).closest('tr').remove();
})
$('#add-more').click(function() {
var vTime = document.querySelector(".vTime").value;
var vDuration = document.querySelector(".vDuration").value;
$('#myTable').append('<tr><td><input type="text" id="vTime" placeholder="Enter Time" class="vTime" /></td><td><input type="text" id="vDuration" placeholder="Enter Duration" class="vDuration" /></td><td><input type="button" value="Delete" /></td></tr>')
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table id="myTable" style="border: 1px solid black">
<tr>
<td>
<input type="text" placeholder="Enter Time" value="9:30" id="vTime" class="vTime" />
</td>
<td>
<input type="text" placeholder="Enter Duration" value="30" id="vDuration" class="vDuration" />
</td>
<td>
<input type="button" value="Delete" />
</td>
</tr>
</table>
<input id="add-more" type="button" value="Add more">
Here, I am adding next row on click of "Add more" button. So let say time text box value is 9:30
and minutes textbox value is 30
then next added textbox value will be 10:00
and 30
in minutes textbox (this can be changed).
How can I get last textbox value and add some amount of minutes in it?