SoFunction
Updated on 2025-03-01

django js instance code to implement dynamic table number

django js implement dynamic table number

<table class="table table-striped">
        <thead>
        <tr class="key_words_head">
          <th>Serial number</th>
          <th>Category</th>
          <th>Keywords</th>
          <th>operate</th>
        </tr>
        </thead>
        <tbody >
        {% for keywords in classify_keywords_obj %}
          <tr class="key_words_tbody">
            <td ></td>
            <td >{{  }}</td>
            <td >{{ .classify_name }}</td>
            <td >{{  }}</td>
            <td><a href="javascript:void(0);" rel="external nofollow" rel="external nofollow" onclick="show_change_model('{{  }}')">edit</a>
              <a href="javascript:void(0);" rel="external nofollow" rel="external nofollow" style="color: red" onclick="del_settings('{{  }}',this)">delete</a></td>
          </tr>
        {% endfor %}
        </tbody>
      </table>
<script>
    function xu_hao() {
      var oTable = $('tr.key_words_tbody').length;
      for (var i = 0; i < oTable + 1; i++) {
        $('tr.key_words_tbody').eq(i).children("td#td_num").empty();
        $('tr.key_words_tbody').eq(i).children("td#td_num").append(i + 1);
      }
    }
  </script>

Summarize

The above is the example code for implementing dynamic serial numbers of django js tables introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!
If you think this article is helpful to you, please reprint it. Please indicate the source, thank you!