How would one make a javascript function which constantly checks to see if the user has input data into one or more textboxes?
Thanks!
How would one make a javascript function which constantly checks to see if the
Share
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.
You shouldn’t use
setInterval. You should useonchangeevent.See http://jsfiddle.net/QwBU8/
But be aware that this event isn’t fired at the moment that the textbox is modified; it is fired when it loses focus (only if it has changed, of course).
If you want to fire the event each time is modified you can use
oninput(but it’s not supported by all browsers).But avoid using
setInterval, it eats up a lot of resources. Imagine that you have 30 tabs opened in your browser, and all of them have a differentsetInterval. The browser will freeze!!