当我拖动;从div中删除文本以输入不激活DOMNodeRemoved
事件。验证文本的删除方式如何?
JS:
$(function() {
$('.content').on('DOMNodeRemoved', function(event) {
console.log(event);
});
});
HTML:
<h2>Div content editable</h2>
<div class="content" contenteditable="true">
drop text to input
</div>
<h2>Input</h2>
<input class="input" type="text"/>
演示:jsbin
答案 0 :(得分:0)
不确定您要找的是:
http://jsbin.com/izorij/5/edit
var cached;
$(function() {
$('.content').on('focusout', function(event) {
if(cached!=this.innerHTML) {
console.log(event);
cached = this.innerHTML;
}
});
});