jquery監聽div、input、textarea內容變化


第一種:change事件

change事件在元素的值發生變化時觸發,適用於input、textarea、select

$("#demo").bind("change", function(){
    alert('a');
});

第一種:DOMNodeInserted事件(插入事件)、DOMNodeInserted事件(移除事件)

DOMNodeInserted事件只有在插入節點時有效,相反DOMNodeRemoved事件,只有在移除節點時有效。
$('#demo').bind('DOMNodeInserted', function() {
   alert('a') 
})
$('#demo').bind('DOMNodeRemoved', function() {
   alert('b') 
})


免責聲明!

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



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