I have a drop down menu. By default it allows only one option to select among all. I want to create a checkbox which when checked should change that dropdown menu to allow multiple options to be selected. How can I achieve this?
<select id="test" name="host">
<option value="host1">host1</option>
<option value="host2">host2</option>
.....
.....
</select>
I want this to be changed to following on checkbox being checked.
<select id="test" name="host" multiple="multiple">
<option value="host1">host1</option>
<option value="host2">host2</option>
.....
.....
</select>
You need to use javascript for that..use a library called ‘JQuery’, it makes it very simple..
Working Demo
Edit: for reverting back..
Working Demo