Set caret position right after the inserted element in a contentEditable div
The following function will do it. DOM Level 2 Range objects make this easy in most browsers. In IE, you need to insert a marker element after the node you’re inserting, move the selection to it and then remove it. Live example: http://jsfiddle.net/timdown/4N4ZD/ Code: function insertNodeAtCaret(node) { if (typeof window.getSelection != “undefined”) { var sel … Read more