实时监听 input 输入框的值变化

摘:https://www.haorooms.com/post/jquery_on_drag

实时监听 input 输入框的值变化

//输入监听
$('#input').bind('input propertychange', function() {
       alert("我是实时监听哦")
});
//回车绑定
$("#input").keydown(function(event){ 
    if(event.which == "13")     
 //回车执行代码
});

select的监听

     $(document).ready(function(){
            $('select#select').change(function(){
               var checkvalue = $('#select').find("option:selected").val();
               alert(checkvalue);
            });
        });

 监听事件on写法解释

 

$(".haorooms").on("click",function(){
    alert("haorooms前端博客")
})
 
$(".haorooms").on({
    click:function(){
              alert("我是点击事件")
    },
    mouseover:function(){
        alert("mouseover");
    },
    mouseout:function(){
        alert("out")
    }
});

 

posted @ 2021-11-05 16:49  关陈七  阅读(1049)  评论(0)    收藏  举报