Form text field length information


Hai Friends…

i have One input field with max length is 10.
user can enter the text in input field,we are show the length of text. it is working fine.but if we give the whitespace the length will not change.
Am I missing something?

My code is :