I want to implement a completion field inside my textarea. Everytime a user types $ a drop down below the char location should appear and display a selection of placeholder/text which if clicked should insert text on the current cursor position.
At the moment I have implemented an event handler which catches keypress events and creates in the parent of the textarea a modal div with that text.
My only problem is I can't figure out how to correctly position my modal dlg, because I can't find any position information.
How do i do the math to end up at the correct character/key location? What attributes can I use for calculation?