i use bootstrap-multiselect (v0.9.8) with option
includeSelectAllOption: true
it is posible that select all to be checked by default when page is loaded?
thx.
Windows: We need to hold down the CTRL button to select multiple options.
Bootstrap Multiselect is a jQuery based plugin that allows users to tick multiple options from a standard Bootstrap select. Its implementation is quite simple, and in exchange brings a lot of UX value. Examples of Bootstrap Multiselect use: Ingredient choice within a pizza delivery system.
Multiple items are selected by holding down SHIFT and clicking them with the mouse or by holding down SHIFT and pressing an arrow key to extend the selection from the previously selected item to the current item. You can also select items by dragging with the mouse.
Click the blue 'Add Field' button. In the pop-up window that appears, make sure the 'Create new field' checkbox is checked, and choose 'Multi-Select Field' from the 'Type' drop-down menu. Give your field a name, and click 'Create Field.
The following is taken from http://davidstutz.github.io/bootstrap-multiselect/, and I am currently using this solution with bootstrap 3.3.1 and bootstrap-multiselect v0.9.8 Be sure to add the false parameter to the 'selectAll' function as that permits you to select all the options without first opening the dropdown.
Example HTML:
<select class="multiselect" id="my-multi-select" name="options[]" multiple="multiple">
<option>1</option>
<option>2</option>
</select>
Example javascript:
$(function() {
$('#my-multi-select').multiselect({
includeSelectAllOption: true
});
$("#my-multi-select").multiselect('selectAll', false);
$("#my-multi-select").multiselect('updateButtonText');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With