Disabled value - survey form example project

I checked the example project’s code for the survey form and I found these 2 lines:

Select an option

and

Select an option

What is the function of the value attribute in these 2 lines?

Please add more detail to this post.

1 Like
  1. The value attribute is the data that gets submitted, if it is not given a value the text inside the option element will be the value.

  2. The disabled attribute sets the option element to be non-selectable. You can use it a bit like the placeholder attribute you know from other input types (like input type text with a placeholder attribute set to some text).

  3. The selected attribute selects the option element as the initially selected element.

Side note: Not sure why (other than to show the difference) the two select elements are using different settings for their first option element.

1 Like

I just realized I made a few mistakes posting the question, but thank you very much, this is exactly what I wanted to ask.