var len = 160 - $(this).val.length;
I get same value foreach key press on target input..
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s because you are asking the length of the val function (which will always be 1), instead of calling it and asking the length of what it returns. Try this:
To illustrate this on Stackoverflow that conveniantly uses jQuery. Observe what would happen if you did the following:
So say we want to bind to the search box and log the number of characters that has been put into it we would do: