I would like Autocomplete dropdown to follow caret
The behavior I'm trying to create is to have a jQuery UI Autocomplete widget attached to a multiline textbox (either textarea or contenteditable) that drops down the autocomplete suggestion box directly below the input text (i.e., just under the caret position) rather than beneath the textarea itself. The position of the dropdown should follow the caret as more letters are typed. I believe it will be easier for the user to see the suggestions closer to what he's typing instead of having to scan to the bottom of the box, then back to the caret every time he types a word.
I think the answer may lie in somehow modifying the autocomplete position option but I have 2 questions with this approach:
1. I would need to get the XY coordinates of the caret in the contenteditable div, I cant figure out how to do that, and
2. Once I have the coordinates, there doesn't seem to be an obvious way to write them to the autocomplete.position.
Can someone please help with an example or two?
Thanks in advance.