当div [contenteditable]为空时(如$(this).html(“”)),插入符号就消失了。
是虫子吗?我还找到了其他一些解决方案。使用setTimeout函数。但对我来说这不是完美的解决方案。当我使用许多contenteditables师移动焦点与tab键。然后该解决方案无法正常工作。
当我在Ubuntu 12.04上测试时,
Firefox 20.0中的点击事件:插入符号消失,
Chrome 25.0中的Focusin事件:插入符号消失了。
$(function() {
$("#alpha").on("click", function(e) {
console.log("click");
$(this).children().html("");
});
$("#beta").on("focusin", function(e) {
console.log("focusin");
$(this).html("");
});
});
您可以对其进行测试my fiddle 单击黄色区域或其他区域。