Тут меняется.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" lang="ru">
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
<title>TEST</title>
</head>
<body id="body" >
<table id="parentId">
<thead>
<tr>
<th>№</th>
<th>Номенклатура</th>
<th>Кол-во</th>
<th>Цена</th>
<th>Сумма</th>
</tr>
</thead>
<tr>
<td><input type="number" value="1" name="str[]" readonly></td>
<td><input type="text" class="form-control" id="name" name="name[]" required></td>
<td><input type="number" class="form-control num" id="num" name="num[]" value="" required></td>
<td><input type="text" class="form-control price" id="price" name="price[]" value="" required></td>
<td><input type="text" class="form-control sum" id="sum" name="sum[]" value="" readonly></td>
<td><a class="deleteRow" href="#"><font color="red">[-]</font></a></td>
</tr>
<tr>
<td><input type="number" value="1" name="str[]" readonly></td>
<td><input type="text" class="form-control" id="name" name="name[]" required></td>
<td><input type="number" class="form-control num" id="num" name="num[]" value="" required></td>
<td><input type="text" class="form-control price" id="price" name="price[]" value="" required></td>
<td><input type="text" class="form-control sum" id="sum" name="sum[]" value="" readonly></td>
<td><a class="deleteRow" href="#"><font color="red">[-]</font></a></td>
</tr>
<tr>
<td><input type="number" value="1" name="str[]" readonly></td>
<td><input type="text" class="form-control" id="name" name="name[]" required></td>
<td><input type="number" class="form-control num" id="num" name="num[]" value="" required></td>
<td><input type="text" class="form-control price" id="price" name="price[]" value="" required></td>
<td><input type="text" class="form-control sum" id="sum" name="sum[]" value="" readonly></td>
<td><a class="deleteRow" href="#"><font color="red">[-]</font></a></td>
</tr>
<tr>
<td><input type="number" value="1" name="str[]" readonly></td>
<td><input type="text" class="form-control" id="name" name="name[]" required></td>
<td><input type="number" class="form-control num" id="num" name="num[]" value="" required></td>
<td><input type="text" class="form-control price" id="price" name="price[]" value="" required></td>
<td><input type="text" class="form-control sum" id="sum" name="sum[]" value="" readonly></td>
<td><a class="deleteRow" href="#"><font color="red">[-]</font></a></td>
</tr>
<tr>
<td><input type="number" value="1" name="str[]" readonly></td>
<td><input type="text" class="form-control" id="name" name="name[]" required></td>
<td><input type="number" class="form-control num" id="num" name="num[]" value="" required></td>
<td><input type="text" class="form-control price" id="price" name="price[]" value="" required></td>
<td><input type="text" class="form-control sum" id="sum" name="sum[]" value="" readonly></td>
<td><a class="deleteRow" href="#"><font color="red">[-]</font></a></td>
</tr>
</table>
<script>
var countOfFields = 5
, curFieldNameId = 0; // что бы не было ошибки
function repos () {
var rows = document.getElementById('parentId').tBodies[0].rows;
var i;
for (i = 0; i < rows.length; i++) {
rows[i].cells[0].children[0].value = i+1;
}
}
parentId.addEventListener('click', function(evt){
if(evt.target.closest('.deleteRow')) {
evt.target.closest('tr').remove();
countOfFields--;
curFieldNameId = curFieldNameId-1;
repos();
}
})
repos();
</script>
</body>
</html>