Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

once you select an item on a multiselect html listbox, is there anyway to deselect all

Tags:

html

select

My users can't seem to deselect all on a select in html. I have a basic multiselect listbox in html:

 <select class="longDropdown" id="SelectedCalendars"
         multiple="multiple" name="SelectedCalendars">
     <option value="13">ER</option>
     <option selected="selected" value="26">Billy 123</option>
     <option selected="selected" value="28">New Cal</option>
 </select>

if a few items start out selected, you can change by clicking on others to remove the selection, but there doesn't seem to be a way for a user to deselect them all. do i really have to write some jquery / javascript code to do this programatically. Is this a flaw in the HTML UI spec?

like image 603
leora Avatar asked Dec 13 '22 19:12

leora


1 Answers

On macOS, the user can + click on the last selected item to deselect it. On other platforms, the user would use Ctrl + click instead.

like image 110
Sean Bright Avatar answered Feb 15 '23 23:02

Sean Bright