I'm using the summernote API as the editor for email, it creates a div to be used as textarea. The only reference that leaves is the "note-editable" class. I made a code to replace a word with a tag with content-editable false so that the user tries to delete it, erase all the text from it. or the code I use:
function insertTag(string, tag){
string[0] = string[0] + '<span contentEditable="false" class="enfatizar">' + tag + '</span> ';
var position = string[0].lenght;
code = string[0] + string[1];
$('#inputMsgEmail').code(code);
}
I wanted to insert the insertion bar into the div '.note-editable' by means of the returned lenght, something like:
$('.note-editable').caretPosition(position);