When the text field is empty the submit should be disabled (disabled="disabled").
When something is typed in the text field to remove the disabled attribute.
If the text field becomes empty again(the text is deleted) the submit button should be disabled again.
We tried something like this:
... but it doesn't work. Any ideas? Thanks.
Solution 1:
The problem is that the change event fires only when focus is moved away from the input (e.g. someone clicks off the input or tabs out of it). Try using keyup instead:
Solution 2:
Solution 3:
or for us that dont like to use jQ for every little thing:
Solution 4:
eric, our code did not seem to work for me when the user enters text then deletes all the text. we created another version if anyone experienced the same problem. here ya go folks: