I have a div with contenteditable set and I am capturing keypress using jquery to call preventDefault() when the enter key is pressed. Similar to this question which insert
by reading quickly and hoping not to be off topic, here is a track for those who, like me, need to insert code at the cursor level of a div:
document.getElementById('editeur').contentWindow.document.execCommand('insertHTML', false, '
');
'editeur' is iframe :
contenu_editeur_wysiwyg.php :
don't forget :
document.getElementById('editeur').contentDocument.designMode = "on";