开发者

Difference between value and defaultValue for a text input in Javascript?

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 chan开发者_运维技巧ging 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.

"defaultValue" applies to: http://www.java2s.com/Code/JavaScriptReference/Javascript-Properties/defaultValueisappliedto.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜