Is it possible to make the optgroup label selectable?

3

It is possible to make the optgroup label option selectable along with the rest of the group options, for example:

 <optgroup label="EUA">
<option value="0">NY</option>
<option value="1">LA</option>

Except that the US would also have to be a selectable option, but it still has to be shown as the parent of these two options.

    
asked by anonymous 23.11.2015 / 16:54

2 answers

2

Well, I have researched here a secure source for W3School, and this really can not be done with the <optgroup> tag because it is a collation option of <options> and not a selector.

Source:

link

    
23.11.2015 / 17:25
2

I've been researching, and following a "clue" I found in a comment from one of the answers to the question I posted in the above comment (in the question), I think the reason for this being impossible with just plain HTML is: / p>

  

optgroup has no attribute value.

That is, it is not possible because optgroup does not have a value attribute . As you can see here , the only attributes of optgroup are:

  

Attribute | Value | Description

     

disabled | disabled | Specifies that an option-group should be disabled
label | text | Specifies a label for an option-group

    
23.11.2015 / 17:29