I am using a drag & drop, pulling labels of text over to a textbox on a webpage. On drop I would like to have it insert the text of the label where the mouse is using jquery.
Unfortunately I can't see a way to determine where the caret would be based on the current mouse position other than getting the relative position of the mouse to the textbox element and working out all of the text font/size/kerning/line-height/newlines/etc.
The browser itself can easily work this out (click the textbox, there's the caret in the right position), but I can't see how to do this in code.
Any help on would be appreciated.
Again, my goal is to drag a label to a textbox and have it drop into the current text based on the position of the mouse using jquery. Although if it gets the job done, I'd use whatever is available. Everything is already done apart from determining the position in the text where the label is dropped.
Cheers!
What I have tried:
So far I've tried using what in-built methods and properties I can find in asp.net and have started on trying to determine the correct position of the caret based on mouse position and the textbox's text. This however, seems like a big workaround for something usually achieved by just clicking the textbox text, so I'm hoping I'm missing something obvious before I continue on this path.