Is there anyway to get the next character after a window.getSelection()? I need to check if the character after the selected text is a space or not...
EDIT: Thank you for your answers! I'm basically using this link to highlight text, but would like to limit things to full words. I've used the presented solution below (by Steven) as a starting point; I think that the following should work:
sel = window.getSelection();
var text = sel.anchorNode.nodeValue;
var index = sel.baseOffset + sel.focusOffset-1;
var isSpace = text[index] === undefined;
if (isSpace) {
alert("space");
}
(In the link above, I used this code right after the makeEditableAndHighlight function call).