jQuery忽略大小写过滤dom内容

 1 <input id='search' type="text" placeholder="Search...">
 2 <table id="downloads" class="table table-bordered table-hover" style="width:100%">
 3 <script>
 4     // 重写jQuery语法
 5     jQuery.expr[':'].Contains = function (a, i, m) {
 6         return jQuery(a).text().toUpperCase()
 7             .indexOf(m[3].toUpperCase()) >= 0;
 8     };
 9 </script>
10 
11 $('#search').on('keyup click', function () {
12     $('#downloads').DataTable().search($(this).val()
13     ).draw();
14 });

 

posted @ 2021-01-06 17:57  士为知己  阅读(275)  评论(0)    收藏  举报