<div class="form-group">
<p>
What is your favorite feature of free Code Camp?
</p>
<select id="most-like" name="most Like" class="form-control" required>
<!--the "value" below here-->
<option disabled selected value>Select an option</option>
<option value="challenges">Challenges</option>
<option value="projects">Projects</option>
<option value="community">Community</option>
<option value="open Source">Open Source</option>
</select>
</div>
The value attribute specifies the value of an <input> element.
The value attribute is used differently for different input types:
- For “button”, “reset”, and “submit” - it defines the text on the button
- For “text”, “password”, and “hidden” - it defines the initial (default) value of the input field
- For “checkbox”, “radio”, “image” - it defines the value associated with the input (this is also the value that is sent on submit)
Note: The value attribute cannot be used with <input type="file"> .
To what I think is your question, what is the use of the “value” in this:
<option disabled selected value>Select an option</option>
I don’t know. But I do notice the the validation that confirms “required” for this select doesn’t seem to work without it.
but in this instance it is a “boolean” attribute, (does not have =“something” at the end of “value” like value=“jack”
what do you think about that?
Being blank doesn’t make it a boolean attribute. You can get better clarification in MDN docs.