Placeholder in contenteditable - focus event issue
I have been trying to ask this before, without any luck of explaining/proving a working example where the bug happens. So here is another try: I’m trying to replicate a placeholder effect on a contenteditable DIV. The core concept is simple: <div contenteditable><em>Edit me</em></div> <script> $('div').focus(function() { $(this).empty(); }); </script> This can sometomes work, but if the placeholder contains HTML, or if there some other processing being made, the editable DIV’s text caret is being removed, and the user must re-click the editable DIV to be able to start typing (even if it’s