Hi all,
I try to explain my problem.
I have a <div contenteditable="true" id="my_editeur>
, where I have defined a keypress “event” which allow me to add a ‘p’ when the user clicks on “enter”.
It functions well, but I would like define the cursor on this new ‘p’ element, because currently my cursor stays on the first 'p' element.
I have tried to use jquery focus function but it seems that we can’t use this function for ‘p’ elements.
Do you know how I can do to solve my problem?
Thanks very much for your help.
My code :
$('#my_editeur').keypress(function(e){
if(e.keyCode == 13) {
e.preventDefault();
$(this).append('<p ><br /></p>');
}
});