我试图在我的代码中包含tablesorter插件,但它不起作用。我已经添加了jquery库和tablesorter文件,但它没有做任何事情。下面是我的代码:
添加的脚本:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="{% static 'MIDIPIRCUSSION_APP/jquery.tablesorter.js' %}"></script>
HTML代码:
<div class="jumbotron2">
<div class="container">
<br>
<center>
<table id="myTable" class="table table-dark" style="text-align: center">
<thead>
<tr>
<th>Fecha de Creación</th>
<th>Título</th>
<th>Duracion</th>
<th>Dificultad</th>
{% if not user.is_staff %}
<th>Jugar</th>
{% endif %}
<th>Configurar Bateria</th>
{% if user.is_staff %}
<th>Modificar</th>
<th>Eliminar</th>
{% endif %}
</thead>
{% for cancion in object_list %}
<tbody>
<tr>
<td>{{cancion.creacion}}</td>
<td>{{cancion.titulo}}</td>
<td>{{cancion.duracion}}</td>
<td>{{cancion.dificultad}}</td>
</tbody>
</table>
javascript代码:
<script>
$(document).ready(function() {
$("myTable").tablesorter();
});
</script>
https://stackoverflow.com/questions/51731996
复制相似问题