I tried looking at many stackoverflow discussions on how to get cursor position on a click on an input box (but many dealt with getting highlighted position using caret instead) - but nothing seems to be working for my very simple requirement.
All I want is a function which, when a mouse is clicked on an will return the position of cursor (in terms of character count from beginning) - please note that by position I mean the character position.
when you click somewhere on an editable input box with some text on it, I want to get the position (in terms of character count from beginning) of cursor after this click - so that I could remember this for a future click(for some specific UI requirement). –
Is there a jQuery (or javascript) function that would do? Any workarounds are welcome too.
Thanks
EDIT- some people are directing me to other posts - but please note that I could not use jQuery Caret or any other plug-in. All I got is jQuery.