2014-02-17 26 views
0

我发现这个小提琴..,它工作正常,但任何人都可以知道如何去除它的大小写敏感。谢谢新手在这里,任何帮助表示赞赏^^如何删除jquery搜索过滤器中的case sensitivitiy

http://jsfiddle.net/ukW2C/3/

$("#searchInput").keyup(function() { 
//split the current value of searchInput 
var data = this.value.split(" "); 
//create a jquery object of the rows 
var jo = $("#fbody").find("tr"); 
if (this.value == "") { 
    jo.show(); 
    return; 
} 
//hide all the rows 
jo.hide(); 

//Recusively filter the jquery object to get results. 
jo.filter(function (i, v) { 
    var $t = $(this); 
    for (var d = 0; d < data.length; ++d) { 
     if ($t.is(":contains('" + data[d] + "')")) { 
      return true; 
     } 
    } 
    return false; 
}) 
//show the rows that match. 
.show(); 
}).focus(function() { 
    this.value = ""; 
    $(this).css({ 
    "color": "black" 
}); 
$(this).unbind('focus'); 
}).css({ 
"color": "#C0C0C0" 

});

+0

并且是小提琴? – Pavlo

+0

小提琴链接在哪里? – Neels

+0

不错的小提琴 - 但哪里? –

回答

0

使用toLowerCase()

jo.filter(function (i, v) { 
    var $t = $(this); 
    for (var d = 0; d < data.length; ++d) { 
     console.log((data[d]).toLowerCase()); 
     if ($t.is(":contains('" + data[d].toLowerCase() + "')")) { 
      return true; 
     } 
    } 
    return false; 
})