There are great answers. But this guy did what i Really wanted. it's slighly different from previous answers
HTML
Name |
Sports |
Country |
Sachin Tendulkar |
Cricket |
India |
Tiger Woods |
Golf |
USA |
Maria Sharapova |
Tennis |
Russia |
Javascript (Jquery)
// When document is ready: this gets fired before body onload
$(document).ready(function(){
// Write on keyup event of keyword input element
$("#kwd_search").keyup(function(){
// When value of the input is not blank
if( $(this).val() != "")
{
// Show only matching TR, hide rest of them
$("#my-table tbody>tr").hide();
$("#my-table td:contains-ci('" + $(this).val() + "')").parent("tr").show();
}
else
{
// When there is no input or clean again, show everything back
$("#my-table tbody>tr").show();
}
});
});
// jQuery expression for case-insensitive filter
$.extend($.expr[":"],
{
"contains-ci": function(elem, i, match, array)
{
return (elem.textContent || elem.innerText || $(elem).text() || "").toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0;
}
});
Live Demo: http://blogs.digitss.com/demo/jquery-table-search.html
Source: http://blogs.digitss.com/javascript/jquery-javascript/implementing-quick-table-search-using-jquery-filter/