I have a document (inside an editable iframe),
I need to find the nearest node to the caret position, not to the parent node, but to the sibling node (so they should have the same parent element) that is (when it is available) left of the carriage position (collapsed selection).
node can be any node, like text node, paragraph, div, etc.
Note. IE is not in the browser .
I have it now:
var content = document.getElementById('iframedocument').contentWindow;
var selection = content.getSelection();
var range = selection.getRangeAt(0);
kenny source
share