Я использую сценарий ниже, чтобы фильтровать результаты в таблице. Только проблема в том, что он чувствителен к регистру. Как я могу сделать его чувствительным к регистру?Javascript Case Sensitive filter
<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 = 'HELLO world! ''so' foo.toLowerCase() === boo.toLowerCase() ' – Nico