what I want to do is specifically when I press the enter button, it creates a new paragraph, the cursor then moves or selects a new editing item, editable to start typing, but I cannot find a way to do this.
<div id="wrap" contenteditable="true">
|| <----cursor posiiton
//*New paragraph content editable when enter is pressed
<p contenteditable="true">New Paragrpah</p>
</div>
if(event.which == 13){
event.preventDefault();
elem.append('<p>insert a new paragraph</p>');
$('#container *').attr('contenteditable','true');
$('p', elem).focus();}
Does anyone have an understanding? would be highly appreciated.
I know that this is possible with an input field and .focus (), but this will not work on contentEditable, it should be a way to do this.
Regards Patrick
source
share