How to find the absolute or relative position of the last letter in an input field?


Maybe this is a strange question. Please, check Bellow you will understand.

Empty input type text, width=200px :


Filled input type text, width=200px :


If input left is 0 how to find the absolute or relative position where the g letter is???

When user enters some text I want to display under last letter a simple div...

The text size hacks are OK, but you could alternatively use a visiblity: hidden span that moves your info div. HTML snippet follows:

<div><input type="text" value="hgello!!" onkeydown="document.getElementById('spacer').innerHTML = this.value;" /></div>
<div><span id="spacer" style="visibility: hidden;"></span>Character</div>

This way you can rely on the browser rendering the same font in roughly the same way into a span.