开发者

Detect elements removing

开发者 https://www.devze.com 2023-02-01 06:15 出处:网络
I need to capture event, when some element was开发者_如何学Go removed from the DOM. Removing can be done in following ways:

I need to capture event, when some element was开发者_如何学Go removed from the DOM.

Removing can be done in following ways:

  1. with jQuery.remove()
  2. after hitting backspace in paragraph (that has "contentEditable" attr)

The only way, I know, to determine second case - is to count elements and compare after each hitting of backspace key.

Maybe there is a more elegant way exist ?


There are the DOM Mutation Events, specifically DOMNodeRemoved and DOMNodeRemovedFromDocument, but IE has historically not supported them. They are supposedly supported in IE9.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号