實時監聽 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")
    }
});

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM