I'm tyring to make a simple sorting search box for a table.
I have the following code:
<input name="search" />
<table id="content">
<tr class="item"> (...) </tr>
<tr class="item"> (...) </tr>
</table>
$(document).ready(function(){
$('input[name="search"]').keydown(function(){
$('tr.item:contains("' + $(this).val()+ '")').prependTo('#content');
});
This works fine, but .contains() is case sensitive.
How can I make it case insenstive?
I found this on the net:
http://bugs.jquery.com/ticket/278#comment:4
http://ericphan.info/blog/2009/3/4/jquery-13-case-insensitive-contains.html
but when I add the following code:
$.extend($.expr[":"], {
"containsIgnoreCase": function(elem, i, match, array) {
return (elem.textContent || elem.innerText || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}});
nothing seems to change and my search box remains case sensitive...