How to avoid the need for ctrl-click in a multi-select box using Javascript?

I thought this would be a simple hack, but I’ve now been searching for hours and can’t seen to find the right search term. I want to have an ordinary multiple select box (<select multiple="multiple">) except I don’t want the user to have to hold down the control key to make multiple selections.

In other words, I want a left click to toggle the <option> element that’s under the cursor without changing any of the others. In other other words, I want something that looks like a combo list box but behaves like a group of check boxes.

Can anybody suggest a simple way to do this in Javascript? Thanks.


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Check this fiddle:

You basically need to override the mousedown event for each <option> and toggle the selected property there.

$('option').mousedown(function(e) {
    $(this).prop('selected', !$(this).prop('selected'));
    return false;

For simplicity, I’ve given ‘option’ as the selector above. You can fine tune it to match <option>s under specific <select> element(s). For ex: $('#mymultiselect option')

Method 2

Had to solve this problem myself and noticed the bugged behavior a simple interception of the mousedown and setting the attribute would have, so made a override of the select element and it works good.


Note: This code does fix buggy behavior by replacing the select element in the DOM. This is a bit agressive and will break event handlers you might have attached to the element.

window.onmousedown = function (e) {
    var el =;
    if (el.tagName.toLowerCase() == 'option' && el.parentNode.hasAttribute('multiple')) {

        // toggle selection
        if (el.hasAttribute('selected')) el.removeAttribute('selected');
        else el.setAttribute('selected', '');

        // hack to correct buggy behavior
        var select = el.parentNode.cloneNode(true);
        el.parentNode.parentNode.replaceChild(select, el.parentNode);

    <select name="sites-list" size="7" multiple>
        <option value="site-1">SITE</option>
        <option value="site-2" selected>SITE</option>
        <option value="site-3">SITE</option>
        <option value="site-4">SITE</option>
        <option value="site-5">SITE</option>
        <option value="site-6" selected>SITE</option>
        <option value="site-7">SITE</option>
        <option value="site-8">SITE</option>
        <option value="site-9">SITE</option>

Method 3

techfoobar‘s answer is buggy, it unselects all options if you drag the mouse.

Sergio‘s answer is interesting, but cloning and removing events-bound to a dropdown is not a nice thing.

Try this answer.

Note: Doesn’t work on Firefox, but works perfectly on Safari/Chrome/Opera. (I didn’t test it on IE)

EDIT (2020)

After 5 years since my original answer, I think best practice here is to replace the dropdown with checkboxes. Think about it, that’s the main reason why checkboxes exist in the first place, and it works nicely with old browsers like IE & modern mobiles without any custom JS to handle all the wacky scenarios.

Method 4

The selected answer without jQuery.
Also, it missed setting the focus when an option is clicked, because you have to do this yourself, if you write e.preventDefault…
Forgetting to do focus would affect CSS-styling, e.g. bootstrap, etc.

var options = []"option"));

options.forEach(function (element)
    // console.log("element", element);
        function (e)
            this.selected = !this.selected;
            return false;
        , false

Method 5

I had same problem today, generally the advice is to use a list of hidden checkboxes and emulate the behavior via css, in this way is more easy to manage but in my case i don’t want to modify html.

At the moment i’ve tested this code only with google chrome, i don’t know if works with other browser but it should:

var changed;
$('select[multiple="multiple"]').change(function(e) {
    var select = $(this);
    var list ='prevstate');
    var val = select.val();
    if (list == null) {
        list = val;
    } else if (val.length == 1) {
        val = val.pop();
        var pos = list.indexOf(val);
        if (pos == -1)
            list.splice(pos, 1);
    } else {
        list = val;
    select.val(list);'prevstate', list);
    changed = true;
}).find('option').click(function() {
    if (!changed){
    changed = false;

Of course suggestions are welcome but I have not found another way

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x