当我拖动&从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
不确定你在找什么:
http://jsbin.com/izorij/5/editvar cached;
$(function() {
$('.content').on('focusout', function(event) {
if(cached!=this.innerHTML) {
console.log(event);
cached = this.innerHTML;
}
});
});