jquery -- 同时监听多个事件


多个事件触发同一反应

$("#redrow").on("click touchend",function(){});//每个监听事件之间用 “空格” 隔开



多个事件触发不同反应
$(".serverinfo").bind("keyup",function() {
    $(this).val($(this).val().replace(/[^0-9.]/g,''));
}).bind("click",function(){
    $(this).select();
    $(this).removeClass("text-danger");
}).bind("paste",function(){
    $(this).val($(this).val().replace(/[^0-9.]/g,''));
}).bind("blur",function(){
    var reg=/^(([01]?[\d]{1,2})|(2[0-4][\d])|(25[0-5]))(\.(([01]?[\d]{1,2})|(2[0-4][\d])|(25[0-5]))){3}$/;
    if(!reg.test($(this).val())){
        //不满足类IP形式
        $(this).next().removeClass("hidden");
    }else{
        //满足类IP形式
        $(this).next().addClass("hidden");
    }
}).css("ime-mode","disabled");

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM