我正在使用以下脚本来筛选表中的结果。只有问题是它是区分大小写的。我将如何去使它不区分大小写?Javascript区分大小写筛选器
<script>
$(document).ready(function() {
$("#searchInput").keyup(function(){
//hide all the rows
$("#fbody").find("tr").hide();
//split the current value of searchInput
var data = this.value.split(" ");
//create a jquery object of the rows
var jo = $("#fbody").find("tr");
//Recusively filter the jquery object to get results.
$.each(data, function(i, v){
jo = jo.filter("*:contains('"+v+"')");
});
//show the rows that match.
jo.show();
//Removes the placeholder text
}).focus(function(){
this.value="";
$(this).css({"color":"black"});
$(this).unbind('focus');
}).css({"color":"#C0C0C0"});
});
</script>
可能的重复[我如何使jQuery包含大小写不区分大小写,包括jQuery 1.8+?](http://stackoverflow.com/questions/2196641/how-do-i-make-jquery-contains-case-insensitive -including-jquery-1-8) – j08691
让它不区分大小写的一个好方法是将'toLowerCase()'应用于两者,所以'var foo ='HelLO WoRLd!'''var boo ='你好! ''so'foo.toLowerCase()=== boo.toLowerCase()' – Nico