Latest web development tutorials

HTML DOM Input Text defaultValue property

Input Text Object Reference Input Text Object

Examples

Modify the default values ​​in the text field:

. Document.getElementById ( "myText") defaultValue = "Goofy";

try it"


Definition and Usage

defaultValue property sets or returns the default value in the text field.

Note: The default value is the value specified in HTML "value" attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support defaultValue property.


grammar

Back defaultValue attributes:

textObject .defaultValue

Setting defaultValue property:

textObject .defaultValue = value

Property Value

value description
value It describes the default value of the text field

Technical details

return value: String represents the default value of the text field


More examples

Examples

Gets the default value of the text field:

var x = document.getElementById ( "myText") defaultValue.;

x The output is:

Mickey

try it"


Input Text Object Reference Input Text Object