I'm a little late to this question, but want to offer a solution if you don't want to use jquery just for this:
<p>A function is triggered when the user releases a key in the input field. The function transforms the characters size.</p> Enter your name: <input type="text" id="fname" onkeyup="myFunction()"> function myFunction(){ var x=document.getElementById("fname"); var initialSize=25-x.value.length; initialSize=initialSize<=10?10:initialSize; x.style.fontSize = initialSize + "px"; }
check out this jsfiddle
source share