技术需求:

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


代码分解:

#wb_follow_btn 是Div的id

DOMNodeInserted 绑定监听方法


完整代码:

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

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

});