4
votes

I thought this would be easy to do but I can't find a way.

I have a ListBox with selection mode set to multiple but I the user wants to be able to select multiple items without having to press CTRL.

Does anyone know an easy way to do this?

1
The bigger question is why? Changing the default behaviour of standard UI controls is a bad idea. - adelphus
You could make it a checkbox list. If you wanted the scrolling, put it in a div with a defined height and overflow: scroll; - dash
The user can drag the items to select multiple. If he needs to select non-consecutive items he needs to use ctrl - Tim Schmelter
Why? Because there is no keyboard. User will need to select non consecutive items so I think I will go with the checkbox list - johnmcp

1 Answers

3
votes

Googled it and find the following: http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/

Here is some pointers:

The just type:

$(function(){
   $("select").multiselect(); 
});

Of course you need to reference jQuery as well, and the css to make it look good.

What the widget does is that it takes an select list and turn it create a list of checkboxes around it and styles them properly.

A simple jsfiddle example I put together: http://jsfiddle.net/AFVfQ/1/

It is not perfect, but it should show you how it works. Note the resources on the left hand side, the I'm referencing jquery ui css and a theme.