What is the difference between value and defaultValue for text inputs in Javascript? And what are the implications of using one instead of the other?
Are they free interchangeable? i.e., does changing one change the other?
What is the difference between value and defaultValue for text inputs in Javascript? And what are the implications of using one instead of the other?
Are they free interchangeable? i.e., does changing one change the other?
defaultValue
is the initial value of the object while value
is the current value of the object after a change has been made. If no changes has been made, value
is equal to defaultValue
.
uhmm... looking for reference, wait.
in the example
<INPUT TYPE="password" NAME="password" VALUE="admin" SIZE=25>
whenever"defaultValue" will output "admin" if the field is changed the "value" getter will output the current value in the field
feaultValue applies to : http://www.java2s.com/Code/JavaScriptReference/Javascript-Properties/defaultValueisappliedto.htm