小编use*_*129的帖子

Twitter Bootstrap行过滤器/搜索框

我很难找到关于如何为Twitter Bootstrap创建简单搜索查询或行过滤器的教程.我尝试了很多,我不确定我做错了什么或者插件与Bootstrap不兼容.如果可以的话请帮忙.

我试过了:

$(document).ready(function() {
 //Declare the custom selector 'containsIgnoreCase'.
      $.expr[':'].containsIgnoreCase = function(n,i,m){
          return jQuery(n).text().toUpperCase().indexOf(m[3].toUpperCase())>=0;
      };

      $("#search").keyup(function(){

          $("#tabela").find("tr").hide();
          var data = this.value.split(" ");
          var jo = $("#tabela").find("tr");
          $.each(data, function(i, v){

               //Use the new containsIgnoreCase function instead
               jo = jo.filter("*:containsIgnoreCase('"+v+"')");
          });

          jo.show();

      }).focus(function(){
          this.value="";
          $(this).css({"color":"black"});
          $(this).unbind('focus');
      }).css({"color":"#C0C0C0"});
});
Run Code Online (Sandbox Code Playgroud)

没有这个...也许我在我的桌子或搜索框上缺少任何"id",我对此很新.

html search filter twitter-bootstrap

14
推荐指数
2
解决办法
2万
查看次数

标签 统计

filter ×1

html ×1

search ×1

twitter-bootstrap ×1