Value in unordered list in HTML

I’ve got a question about the code below. What is the point of using value in unordered list? I found that code and now I wonder should I always give value to unordered lists, because I thought it’s only for <ol>.

<ul style="list-style: none;">
          <li class="radio"><label>Definitely<input name="radio-buttons" value="1"  type="radio" class="userRatings" ></label></li>
          <li class="radio"><label>Maybe<input name="radio-buttons" value="2"  type="radio" class="userRatings" ></label></li>

Thanks for your help!

An unordered list typically is a bulleted list of items. HTML gives you the ability to customise the bullets, to do without bullets and to wrap your list items horizontally or vertically for multicolumn lists.


The value attribute isn’t on the <ul> it is on the radio button input element. It doesn’t have anything to do with what elements the input is inside of.

It is the initial or current value of the input. You can get and set the value and the value is also sent on form submit.

For radio buttons and checkboxes, it works a little differently. The default value for them is on, so if you have multiple radio button or checkbox inputs with the same name (grouping), without specifying a different value for each grouped input it becomes hard to identify them on submit.

We have an up coming challenge on the new version of the curriculum which explains this (the link will not stay up forever and you shouldn’t use it to complete any challenges).

Thank you, now everything is clear to me :slight_smile: