我的带有javascript的表过滤器不工作

我的带有javascript的表过滤器不工作,javascript,java,spring,h2,Javascript,Java,Spring,H2,我正在用springboot做一个关于intellij的项目,我有一个动态表。我放了一个搜索框,并添加了一个脚本,理论上它可以工作,但实际上没有 这是我的带有输入框的表格: <input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names.."> <table id="tablePati

我正在用springboot做一个关于intellij的项目,我有一个动态表。我放了一个搜索框,并添加了一个脚本,理论上它可以工作,但实际上没有

这是我的带有输入框的表格:

<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names..">
<table id="tablePatients" width="100%" border="1px solid black" >
<thead>
<tr>
    <th>Id</th>
    <th>Nome</th>
    <th>Cognome</th>
</tr>
</thead>
<tbody id="mytable">
<tr th:each="patient : ${allPatients}">
    <td th:text="${patient.id}">1</td>
    <td th:text="${patient.name}">w</td>
    <td th:text="${patient.surname}">e</td>
    <td> <a href="show?id=10" th:href="@{show(idPatient=${patient.id} , idDoctor=${doctor.id})}"> show </a></td>
    <td> <a href="addPrescription?id=10" th:href="@{newPrescription(idPatient=${patient.id} , idDoctor=${doctor.id})}"> add prescription </a></td>
</tr>
</tbody>

身份证件
诺姆
同源的
1.
W
E
以下是脚本:

<script>
$(document).ready(function(){
    $("#myInput").on("keyup", function() {
        var value = $(this).val().toLowerCase();
        $("#myTable tr").filter(function() {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
        });
    });
});

$(文档).ready(函数(){
$(“#myInput”)。在(“keyup”,function()上{
var value=$(this.val().toLowerCase();
$(“#myTable tr”).filter(函数(){
$(this).toggle($(this).text().toLowerCase().indexOf(value)>-1)
});
});
});
以下是我在head中导入的库:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>


有人能帮我理解我做错了什么吗?

您的脚本中的表id错误,请尝试以下操作:

$(文档).ready(函数(){
$(“#myInput”)。在(“input”,function()上{
var value=$(this.val().toLowerCase();
$(“#mytable tr”).filter(函数(){
if($(this).text().toLowerCase().indexOf(值)=-1){
$(this.hide();
}否则{
$(this.show();
}
});
});
});

身份证件
诺姆
同源的
1.
W
E