使用Jquery

时间:2016-03-24 22:39:08

标签: jquery

我希望在此函数结束时使用jquery添加其他更改触发器。目前,唯一的更改条件是.keyup,但我也想添加.mouseup。我知道有.on的方法,但我还没有找到方法。可能是语法错误。

                    var ButtonVal =  null
var txt= ""
$("input.search").change(function() {
    txt = $("input.search").val();

    if (txt) { function search(){

          if (ButtonVal == null) {

         $("#WebPartWPQ5").find("tr.ms-itmhover:not(:Contains("+txt+"))").hide();
         $("#WebPartWPQ5").find("tr.ms-itmhover:Contains("+txt+")").show();



         $("#WebPartWPQ6").find("tr.ms-itmhover:not(:Contains("+txt+"))").hide();
         $("#WebPartWPQ6").find("tr.ms-itmhover:Contains("+txt+")").show();


         $("#WebPartWPQ4").find("tr.ms-itmhover:not(:Contains("+txt+"))").hide();
         $("#WebPartWPQ4").find("tr.ms-itmhover:Contains("+txt+")").show();


         $("#WebPartWPQ7").find("tr.ms-itmhover:not(:Contains("+txt+"))").hide();
         $("#WebPartWPQ7").find("tr.ms-itmhover:Contains("+txt+")").show();


         $("#WebPartWPQ2").find("tr.ms-itmhover:not(:Contains("+txt+"))").hide();
         $("#WebPartWPQ2").find("tr.ms-itmhover:Contains("+txt+")").show();


         $("#WebPartWPQ8").find("tr.ms-itmhover:not(:Contains("+txt+"))").hide();
         $("#WebPartWPQ8").find("tr.ms-itmhover:Contains("+txt+")").show();
        }
                    if(ButtonVal != null){
        $("#WebPartWPQ5").find("tr.ms-itmhover:not(:Contains("+txt+"):Contains("+ButtonVal+"))").hide();
        $("#WebPartWPQ5").find("tr.ms-itmhover:Contains("+txt+"):Contains("+ButtonVal+")").show();      

         $("#WebPartWPQ6").find("tr.ms-itmhover:not(:Contains("+txt+"):Contains("+ButtonVal+"))").hide();
        $("#WebPartWPQ6").find("tr.ms-itmhover:Contains("+txt+"):Contains("+ButtonVal+")").show();      

        $("#WebPartWPQ4").find("tr.ms-itmhover:not(:Contains("+txt+"):Contains("+ButtonVal+"))").hide();
        $("#WebPartWPQ4").find("tr.ms-itmhover:Contains("+txt+"):Contains("+ButtonVal+")").show();      

        $("#WebPartWPQ7").find("tr.ms-itmhover:not(:Contains("+txt+"):Contains("+ButtonVal+"))").hide();
        $("#WebPartWPQ7").find("tr.ms-itmhover:Contains("+txt+"):Contains("+ButtonVal+")").show();      

        $("#WebPartWPQ2").find("tr.ms-itmhover:not(:Contains("+txt+"):Contains("+ButtonVal+"))").hide();
        $("#WebPartWPQ2").find("tr.ms-itmhover:Contains("+txt+"):Contains("+ButtonVal+")").show();      

        $("#WebPartWPQ8").find("tr.ms-itmhover:not(:Contains("+txt+"):Contains("+ButtonVal+"))").hide();
        $("#WebPartWPQ8").find("tr.ms-itmhover:Contains("+txt+"):Contains("+ButtonVal+")").show();      
        }
        } search();
        }         }).keyup(function(){$(this).change();

});

0 个答案:

没有答案