简体   繁体   中英

select multiple items in select option without using 'ctrl' key

is there a way I could select multiple items in multiple select dropdown without using 'ctrl'? below is my snippet which so far I tried and unfortunately not working. Any help, ideas, clues, suggestions, recommendations please?

 $(document).ready(function(){ $("#options option").click(function(){ $(this).prop("selected",true); }); }); 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <select id="options" class="form-control" multiple> <option value="1">option one</option> <option value="2">option two</option> <option value="3">option three</option> <option value="4">option four</option> <option value="5">option five</option> </select> 

You could go for a jQuery plugin solution. DEMO JSFiddle

$(function () {
    $('select').multipleSelect();
});

You can find the 'multiple select' project at GitHub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM