jquery实现页面的搜索功能

 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   })

 

posted @ 2018-05-16 11:52  前端极客  阅读(3678)  评论(0)    收藏  举报