+ 1
what is the function of value attribute in <input>?
4 Answers
+ 1
@marco The 'name' attribute is submitted with the form data.
'value' is optional except when 'type' attribute is checkbox or radio.
0
it's the value that will be processed after the submission. As for example
<input type="radio" value="NAME1" /> <br/>
<input type="radio" value="NAME2" />
After submitting, if the first choice is selected by the user, the NAME1 value will be processed.
0
It depends on 'type' attribute. If the type is "text, the 'value' is optional and could be used like a placeholder that should be replaced by the user with the real value. Example:
<input type="text" name="firstname" value="Joe">
It's the 'name' attribute which gets processed in this case.
In the case of using <input> as a submit button, the value "Submit" is what the button text will be. It could also be a 'Reset' or 'OK' button.
0
zinc... your answer isn't 100% correct.. the "value attribute" gets always processed.. name attribute is just a "name" for that data entry.
In the case that you highlighted, the "value" is not optional... it is just or defined by the user or defined in the code