Показать сообщение отдельно
  #6 (permalink)  
Старый 14.10.2020, 17:51
Аватар для voraa
Профессор
Отправить личное сообщение для voraa Посмотреть профиль Найти все сообщения от voraa
 
Регистрация: 03.02.2020
Сообщений: 2,750

Не изменяются вообще? При удалении? При добавлении?
Не имея всего кода отлаживать невозможно.
Вот такой простой пример перенумеровывает строки в таблице
<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>
</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>
</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>
</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>
</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>
</tr>
      </table>
<script>
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;
	}
}
repos()
</script>
</body>
</html>
Ответить с цитированием