Home > Back-end >  How to create more than one option for option
How to create more than one option for option

Time:10-13

Is there a way to give an option optionS ? I'm using CSelect to make options. One of the options should contain options too.

<CSelect custom name="select_pattern_filter" id="select_pattern_filter" onChange={onChange} >
  <option value="" defaultValue>Veuillez sélectionner</option>
  <option value="opt1">op1</option>
  <option value="opt2">opt2</option>
  <option value="op3">op3</option>
</CSelect>

The opt3 should contain 2 options. Is there a way to do that?

CodePudding user response:

you could add another tag to the opt3; the same way you would treat a list inside another list.

<ul>
    <li>List one</li>
    <li>
        <ul>
        <li>List inside</li>
        <li>List inside</li>
        </ul>
    </li>
</ul>

CodePudding user response:

The only way I know of to do this is via arrays or objects

See previous example:

<select name="">

<option value='{"num_sequence":[0,1,2,3]}'>Option one</option>

<option value='{"foo":"bar","one":"two"}'>Option two</option></select>

  • Related