在本文中,我们将使用 HTML 设置输入元素的值。 HTML 中 元素的 value 属性用于指定 input 元素的初始值。不同的输入类型有不同的含义:
- “button”、“reset”和“submit”属性指定按钮上的文本。
- “text”、“password”和“hidden”属性指定输入字段的初始值。
- “checkbox”、“radio”和“image”属性指定与输入关联的值。
句法:
属性值:它包含指定输入元素值的单值文本。
示例 1:
HTML
How to specify the value of an
input element using HTML?
GeeksforGeeks
How to specify the value of an
input element using HTML?
Input Value:
HTML
How to specify the value of an
input element using HTML?
GeeksforGeeks
How to specify the value of an
input element using HTML?
输出:
示例 2:
HTML
How to specify the value of an
input element using HTML?
GeeksforGeeks
How to specify the value of an
input element using HTML?
输出: