Bootstrap-multiselect: Single selection without radio buttons?

Created on 31 Dec 2013  路  9Comments  路  Source: davidstutz/bootstrap-multiselect

Is there a way to accomplish single-selection without showing the radio buttons? My purpose is to have all my "selects" (single-selection and multi-selection) render visually the same, but I would rather have less visual distraction to the users when they only need to select a single item.

question

All 9 comments

You could add an appropriate event handler for the onChange event. I will add a demo with the next commit.

Thank you! I do appreciate the demo, but I may have not been clear earlier because in single-select mode I would also like the checkboxes to not be shown. Basically I would (at times) use the bootstrap-multiselect just like a regular dropdown but without any checkbox or radio button functionality. Then my users can see that single-select and multi-select dropdowns look visually similar when I am laying out forms, but the single-select dropdowns show only the minimal information (the dropdown item(s) text) without checkboxes / radio buttons being visible.

Bootstrap multiselect is built around the inputs, so it's not trivial to just remove them. However, they should still function properly if hidden.

What if you just hide them with a class like:

.multiselect-container input
{
    display: none
}

Just a quick note, adding that display none breaks select all behavior, but you can fix it by removing .filter(':visible'); from buildDropdownOptions, though I don't know if there are any side effects of making that change :)

Thanks for the note, will include this issue in FAQ of the documentation.

Hello David ,I'm having one doubt regarding multi select ,can u please help me,
Q)How to get "Select" tag id for particular dropdown with checkbox ,if there are more than one

An alternative to fix the .filter(':visible') problem is to hide the checkboxes with visibility: hidden; instead, or opacity: 0

That will allow you to keep the original source code as-is.

Just to hide the single select radios, while keeping the checkboxes:

.multiselect-container input[type=radio] {
    display: none;
}

How would one hide the checkboxes -via CSS- but only when they correspond to option groups? (I found that if I have collapsible option groups, the checkboxes always show up for the groups, while I want to disallow a check of all the items in the option group).

Was this page helpful?
0 / 5 - 0 ratings