I have a document (inside editable iframe),
I need to retrieve a closest node to the caret position, not the parent node, but the sibling node (so they must have same parent) that is located (when available) left to the caret position(collapsed selection).
The node can be any node, like text node, paragraph, div and etc.
Note: the browser is not IE.
I have this for now:
var content = document.getElementById('iframedocument').contentWindow;
var selection = content.getSelection();
var range = selection.getRangeAt(0);
This works for me:
Another question, firefox adds one or two
tags after new line, is there a simple wa to remove them or I must search for them and “removechild” them?