JSFiddle - React, Tailwind, and code Playground
HTML
<table>
<tr>
<td>
<input type="text" name="SomeCollection[0].Property1" />
<input type="button" class="delete" value="delete"></input>
</td>
</tr>
<tr>
<td>
<input type="text" name="SomeCollection[1].Property1" />
<input type="button" class="delete" value="delete"></input>
</td>
</tr>
<tr>
<td>
<input type="text" name="SomeCollection[2].Property1" />
<input type="button" class="delete" value="delete"></input>
</td>
</tr>
</table>
JavaScript
$('.delete').click(function(e) {
// Get table body and rows
var body = $(this).closest('tbody');
// Remove current row
$(this).closest('tr').remove();
// Get new set of rows from table body
var rows = body.find('tr')
// Update all indeces in rows
var re = new RegExp(/\[[0-9]+\]/);
var index = 0;
rows.each(function () {
$(this).find('input').each(function (e) {
var input = $(this).attr('name');
if (input) {
$(this).attr('name', input.replace(re, '['+index+']'));
}
});
index ++;
});
});