Caret position in pixels in an input type text (not a textarea) [duplicate]
问题 This question already has answers here : How do I get the (x, y) pixel coordinates of the caret in text boxes? (3 answers) Closed 5 years ago . UPDATE : duplicate of Get cursor or text position in pixels for input element. TL; DR - use the incredibly lightweight and robust textarea-caret-position Component library, which now supports <input ype="text"> as well. Demo at http://jsfiddle.net/dandv/aFPA7/ Is there a way to know where the caret is inside an HTML text field? <input type='text' /> I