我正在使用以下腳本來篩選表中的結果。只有問題是它是區分大小寫的。我將如何去使它不區分大小寫?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