猿问

过滤器不适用于 html 表中的多个下拉列表

我正在为表格创建一个下拉过滤器,并为每一列设置一个下拉过滤器。但是第一列上唯一的过滤器正在工作,过滤器的其余部分不起作用,当我尝试过滤它们时,列中的元素消失了。


<head>


<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">


<style>

  .bodycontent{

    margin-left: 5%;

    margin-right:5%;

  }

  td{

    padding:10px;

    text-align:center;

  }


</style>

</head>


<body >

    <div class="bodycontent">



<table id="table_format" class="table table-striped ">

                    <thead style="background-color: #70AD47">

                        <tr>

                            <th>Category

                              <select id="filterText" style="display:inline-block;" onchange="filterText()">

                              <option disabled selected>Select</option>

                              <option value="all">All</option>

                              <option value="School Nutrition">School Nutrition</option>

                              <option value="Food Safety">Food Safety</option>


                            </select>

                            </th>



                            <th>Course Title</th>

                            <th>Hours of Instruction

                             <select id="filterText" style="display:inline-block;" onchange="filterText()">

                              <option disabled selected>Select</option>

                              <option value="all">All</option>

                              <option value="one">1</option>

                              <option value="two">2</option>

                              <option value="three">3</option>


                            </select>

                            </th>



是否可以让过滤器适用于所有列?也可以多个过滤器同时工作。


扬帆大鱼
浏览 157回答 2
2回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答