I have an easy question for you today. I have a select box that enables the user to select multiple items. Also, when the user returns to the page, he can see which items he selected and unselect them if necessary. The trouble is that when I try to unselect, the selection just turns gray; it does NOT unselect.
<select name="MySelect" multiple> <option value="1">1</option> <option value="2">2</option> <option value="3" selected="selected">3</option> <option value="4">4</option> <option value="5">5</option> </select>
So, when the element above renders to the page, I have no way to unselecting the option. The value is STILL getting passed to the form.
Any help?
You can deselect any cells within the selected range with the Deselect Tool. Pressing the Ctrl key, you can click, or click-and-drag to deselect any cells or ranges within a selection. If you need to reselect any of those cells, continue holding the Ctrl key and reselect those cells (for Mac, use the Cmd key).
The option to be removed is selected by getting the select box. The value to be removed is specified on the value selector (value='optionValue') on the select box. The remove() method is then used to remove this selected option. The find() method can be used to find the option in the value with the value selector.
You can deselect options in a multi-value select list by ctrl-clicking it.
You can deselect options in a multi-value select list by ctrl-clicking it.
You can use JS object to memorize the status of a row and click action on select (JQuery).
$('#yourselect').click( function(e){ var i = this.selectedIndex; if(this.options[i].selectedOld==true){ this.options[i].selected = false; this.options[i].selectedOld = false; } else{ this.options[i].selectedOld = true; } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With