Hi Guys,
Is there a way to declare a local var that is kept updated as form input changes?
I'd like to be able to declare a var that represents the contents of a form field.
If I declare the var before any input is entered into the form field, I have to update the var again before I do any comparisons.
Basically, I'd like to declare something early on like this:
var myPassword = document.forms["registerForm"]["password"].value;
So that anytime I reference myPassword it's value is the current state of the field.
For instance, if I set the var early, it's just going to be blank. But then if someone updates the field, I'd have to set the var again to get it updated. Can I get around that?
Is there a way to declare a local var that is kept updated as form input changes?
I'd like to be able to declare a var that represents the contents of a form field.
If I declare the var before any input is entered into the form field, I have to update the var again before I do any comparisons.
Basically, I'd like to declare something early on like this:
var myPassword = document.forms["registerForm"]["password"].value;
So that anytime I reference myPassword it's value is the current state of the field.
For instance, if I set the var early, it's just going to be blank. But then if someone updates the field, I'd have to set the var again to get it updated. Can I get around that?