Hallo Experts,
I have a standard "select multiple" HTML Input field als below:
<select multiple="multiple" size="5" id="mysel" name="countries">
<option value="2">Afghanistan</option>
<option value="4">Aland</option>
</select>
As this is a "multiselect", to select more than one value you have to hold the CTRL Key and selct any further elements.
==>However what I want to achieve is, that:
1. Klicking and UNSELECTED option SELECTs it 2. Klicking an SELECTED option UNSELECTS it.
= The idea is to avoid having to press the CTRL Key and change the "usage-semantics" of this input field. Elements should only be selectable and unselectable by clicking (=Toggling of the select status)
However I didnt menage so far to implement this. The pseudo-code should look something like this.
- Catch a Click event.
- Check if the element that was clicked was unselected, then select it
- Or if the element that was clicked was selected, then unselect it.
How should I implment this?
Thank you very much!! Tim