摘: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") } });