0

How can I make something like this?This is a sample image of the output I want Thanks in advance. Just starting to learn new things

<form>
<select>
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3
        <select>
            <option value="3.1">3.1</option>
            <option value="3.2">3.2</option>
        </select>
    </option>
</select></form>
1437
  • 13
  • 4
  • no you cannot by nesting select like this – Temani Afif Jul 26 '18 at 20:01
  • 2
    You cannot do that with selects. What you show in your image looks more like a menu. What you can do this this: https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_optgroup That does come close. – KIKO Software Jul 26 '18 at 20:01
  • 1
    That is a simple dropdown menu. You can either do it `onclick` using JS, or `:hover` using CSS3. There are plenty of tutorials in the internet, even here on stackoverflow. For example: https://stackoverflow.com/questions/9100344/pure-css-multi-level-drop-down-menu – PStarczewski Jul 26 '18 at 20:02
  • @TemaniAfif Agreed, you need to use lists in order to implement this – Saleh Mahmood Jul 26 '18 at 20:02
  • im using select cause i need it in my form submission – 1437 Jul 26 '18 at 20:09
  • You will be able to do this with lists now with select. – Marcus Stratu Jul 26 '18 at 20:10
  • @1437 Do you want to use Bootstrap? It will make this a lot easier. – Unmitigated Jul 26 '18 at 20:47
  • If you need it included in your form submission, then use some JS to handle the form submission. You can't nest selects within one another. This is a great opportunity to take advantage of nest lists though. – TomJ Jul 26 '18 at 22:21
  • can you show me how to do it? thanks – 1437 Jul 27 '18 at 16:50

0 Answers0