I have a need to create some sub selects on a form. So when you hover/click on the option a subset appears eg.
Lorry|
Car|Saloon
|Coupe
|Estate
Van|
I know we can create a menu dropdown but I don’t know how the selection could be included in the form POST
I am not familiar with jQuery but proficient with JavaScript and PHP
If used unordered list with some css and java script I can get the effect I want but don’t know how to record the value select with out using
<form method="POST" action="#"> <ul>
<li ><a href="#" >Lorry</a> </li>
<li ><a href="#" >Car</a>
<ul>
<li><a href="#">Saloon</a> </li>
<li><a href="#">Coupe</a>
<li><a href="#">Estate</a>
</li>
</ul>
</li>
<li ><a href="" >Van</a>
<ul>
<li><a href="#">Basic</a> </li>
<li><a href="#">Luton</a> <ul>
<li><a href="#">Low Loader</a> </li>
<li><a href="#">Tail lift</a> </li>
</ul>
</li>
<li><a href="#">Transit</a> </li>
</ul>
</li>
</ul>
<input type="text" name="Vehicle" id="Vehicle" hidden>
2
Answers
One thing you can do is make another select (outside of the first one) and let it dynamically adjust to the value of the first select. You can do this by adding on eventlistener to the first select:
This is one way you can solve it. I don’t know if it is possible in raw HTML.
Something like this could save some space, then you could add the category values to your options to indicate the category.
https://jsfiddle.net/jasonbruce/L6nc9rwh/1/