技術需求:
當Div內容發生變化生,需要監聽事件,並執行指定的方法。
代碼分解:
#wb_follow_btn 是Div的id
DOMNodeInserted 綁定監聽方法
完整代碼:
$("#wb_follow_btn").bind('DOMNodeInserted', function(e) {
alert('element now contains: ' + $(e.target).html());
});
技術需求:
當Div內容發生變化生,需要監聽事件,並執行指定的方法。
代碼分解:
#wb_follow_btn 是Div的id
DOMNodeInserted 綁定監聽方法
完整代碼:
$("#wb_follow_btn").bind('DOMNodeInserted', function(e) {
alert('element now contains: ' + $(e.target).html());
});