When the div [contenteditable] is empty (for example, $ (this) .html (""), the carriage has disappeared.
This is mistake? I also found another solution. using the setTimeout function. but this is not a perfect solution for me. when I use a lot of content to separate content using the tab key. then this solution does not work correctly.
When I tested Ubuntu 12.04,
in Firefox 20.0 Click event: carriages disappeared,
in Chrome 25.0 Focusin event: carriages disappeared.
$(function() { $("#alpha").on("click", function(e) { console.log("click"); $(this).children().html(""); }); $("#beta").on("focusin", function(e) { console.log("focusin"); $(this).html(""); }); });
You can check it out my violin. Click the yellow area or another area.
source share