mpsbhat
mpsbhat

Reputation: 2773

Select/unselect option of a multiselect selectbox without pressing control key and changing the style

I have a multi select select box here in this fiddle drawn as,

<select id="select" multiple>
    <option value="-1">Select</option>
    <option value="1">a</option>
    <option value="2">b</option>
    <option value="3">c</option>
    <option value="4">d</option>
</select>

How can I select multiple values without pressing Ctrl key. ie, when I select an option, if it's not selected already should be selected and vice versa.

EDIT:
1. Also how can I style that multi select dropdown such that it can be displayed as similar as a single select dropdown.

2. I tried using the above example and sample is here: http://jsfiddle.net/mpsbhat/ua057y5t/. But in this case I cant able to fire the change event then.

Upvotes: 1

Views: 4435

Answers (3)

evilReiko
evilReiko

Reputation: 20473

  1. For multi-select without holding CTRL(Windows)/CMD(Mac), try this solution.

  2. For styling, you might be looking for:

    -webkit-appearance: none;/* Safari, Chrome */
    -moz-appearance: none;/* Firefox */
    

but then you need to style it yourself, background-color, font-size, etc.

Upvotes: 1

Rushee
Rushee

Reputation: 766

Check this JQuery plugin :- " Multi select avoiding ctrl button "

Hope this will help you.

Upvotes: 1

3y3skill3r
3y3skill3r

Reputation: 1026

You are probably searching for smething like this, check discusion: jquery select and unselect multiple input without ctrl click

Upvotes: 1

Related Questions