JSFiddle - React, Tailwind, and code Playground
HTML
<button id="AddButton">Add Input</button>
<hr />
<table>
<tbody>
<tr><td><input type="text" name="ItemPrice[]" id="ItemPrice-0"></td>
</tr>
</tbody>
</table>
<hr />
<button id="GetValue">Get Value</button>
CSS
table {border: 1px solid #ddd;}
JavaScript
function AddRow() {
var i = $('table tbody tr').length;
var tableRow = '<tr>';
tableRow += '<td><input type="text" name="ItemPrice[]" id="ItemPrice-' + i + '"></td>';
tableRow += '</tr>';
$('table tbody').append(tableRow);
}
$('#AddButton').click(function() {
AddRow();
});
$('#GetValue').click(function() {
var i = $('table tbody tr').length;
alert( $('[id^=ItemPrice]:last').val());
});