1 $(function(){ 2 $("input[type=button]").click(function(){ 3 var txt=$("input[type=text]").val(); 4 if($.trim(txt)!=""){ 5 6 $("table tr:not('#theader')").hide().filter(":contains('"+txt+"')").show().css("background","red"); 7 }else{ 8 $("table tr:not('#theader')").css("background","#fff").show(); 9 } 10 }); 11 })