Get current word on caret position
问题 How can I get a word in textarrea by its current caret position? I tried something like this, however this returns just the words first letter upto the character at caret position. For example: if the cursor is between fo and o it returns fo and not foo as excpected. Fo | o bar is not equal to bar foo. => Fo expects Foo Foo bar is not equ | al to bar foo. => equ expects equal . Here's what I've done so far: function getCaretPosition(ctrl) { var start, end; if (ctrl.setSelectionRange) { start