JQuery如何监听DIV内容变化
更新:HHH   时间:2023-1-7


技术需求:

当Div内容发生变化生,需要监听事件,并执行指定的方法。


代码分解:

#wb_follow_btn   是Div的id

DOMNodeInserted  绑定监听方法


完整代码:

$("#wb_follow_btn").bind('DOMNodeInserted', function(e) {      

   alert('element now contains: ' + $(e.target).html());  

});


返回web开发教程...