How to use value in JavaScript
This article mainly introduces "how to use value in JavaScript". In daily operation, I believe many people have doubts about how to use value in JavaScript. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about "how to use value in JavaScript". Next, please follow the editor to study!
In JavaScript, the value property can set or return the default value of the text field, and the syntax is "attribute.value=value" or "attribute.value".
The operating environment of this tutorial: windows10 system, javascript1.8.5 version, Dell G3 computer.
What is the use of value in JavaScript
The value property sets the default value for the text field.
Syntax:
Set property value
Attribute.value=value
Returns the property value
Attribute.value
Return value: a string that represents the value of the property.
Examples are as follows:
Function alertValue () {alert (document.getElementById ("password1") .value)}