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') 
})
原文地址:https://www.cnblogs.com/wangyongx/p/10711513.html