I was enjoying trying to develop a kind of completor suggestor on a textarea, I wanted it to jump when the tab key was pressed, that what easy with capturing the keydown event and the help of event.preventDefault.

But the thing what wasn’t such easy was the capturing the last word on the textarea from the cursor.

But with the help of the code of the insertAtCaret function I was abble to obtain it: