bootstrap-multiselect icon indicating copy to clipboard operation
bootstrap-multiselect copied to clipboard

Dropdown Renders twice?

Open AnthonyLombard opened this issue 7 years ago • 9 comments

this is the html it spits out

<span class="multiselect-native-select"><span class="multiselect-native-select"><select id="example-getting-started" multiple="multiple"> <option value="cheese">Cheese</option> <option value="tomatoes">Tomatoes</option> <option value="mozarella">Mozzarella</option> <option value="mushrooms">Mushrooms</option> <option value="pepperoni">Pepperoni</option> <option value="onions">Onions</option> </select><div class="btn-group"><button type="button" class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" title="None selected"><span class="multiselect-selected-text">None selected</span> <b class="caret"></b></button><ul class="multiselect-container dropdown-menu"><li class=""><a tabindex="0"><label class="checkbox"><input type="checkbox" value="cheese"> Cheese</label></a></li><li class=""><a tabindex="0"><label class="checkbox"><input type="checkbox" value="tomatoes"> Tomatoes</label></a></li><li class=""><a tabindex="0"><label class="checkbox"><input type="checkbox" value="mozarella"> Mozzarella</label></a></li><li class=""><a tabindex="0"><label class="checkbox"><input type="checkbox" value="mushrooms"> Mushrooms</label></a></li><li class=""><a tabindex="0"><label class="checkbox"><input type="checkbox" value="pepperoni"> Pepperoni</label></a></li><li class=""><a tabindex="0"><label class="checkbox"><input type="checkbox" value="onions"> Onions</label></a></li></ul></div></span><div class="btn-group"><button type="button" class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" title="None selected"><span class="multiselect-selected-text">None selected</span> <b class="caret"></b></button><ul class="multiselect-container dropdown-menu"><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="cheese"> Cheese</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="tomatoes"> Tomatoes</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="mozarella"> Mozzarella</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="mushrooms"> Mushrooms</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="pepperoni"> Pepperoni</label></a></li><li><a tabindex="0"><label class="checkbox"><input type="checkbox" value="onions"> Onions</label></a></li></ul></div></span>

on page code

<select id="example-getting-started" multiple="multiple"> <option value="cheese">Cheese</option> <option value="tomatoes">Tomatoes</option> <option value="mozarella">Mozzarella</option> <option value="mushrooms">Mushrooms</option> <option value="pepperoni">Pepperoni</option> <option value="onions">Onions</option> </select> <script type="text/javascript"> $(document).ready(function() { $('#example-getting-started').multiselect(); }); </script>

do you have any idea why?

AnthonyLombard avatar Apr 19 '17 09:04 AnthonyLombard

any solution to this ? i'm also facing this ..

syedali90 avatar Apr 25 '17 07:04 syedali90

Same here... I'm getting the standard multiselect rendered (with options) before the plug-in rendering, which does not have any options.

john-hall avatar May 02 '17 14:05 john-hall

you can hide the select element

msdabre avatar May 09 '17 18:05 msdabre

maybe you are calling the css file like script not like link

junimbarrico avatar Aug 22 '17 19:08 junimbarrico

Are you using the master branch?

davidstutz avatar Oct 28 '17 20:10 davidstutz

I have the same issue.

@davidstutz, The version used is "bootstrap-multiselect": "^0.9.13" with bower

UPD. no, two selects rendered in master in ^0.9.13 I just don't have the dropdown...

seyfer avatar Nov 15 '17 16:11 seyfer

Hi! Same here. The problem disapear if I remove bootstrap.min.css(3.3.2) from my page's sources. If I upgrade to 4.0.0, the double rendering disapear, but when I click on the button, there is no dropdown. I'm currently using v0.9.15 of bootstrap-multiselect

HH-1 avatar Mar 09 '18 11:03 HH-1

Component has bug with multi wrapper on re-init select:

https://jsfiddle.net/wdpyufhs/

Bootstrap: 4.1.0 jQuery: 3.3.1 Bootstrap-multiselect: 0.9.15

bm-896

dansamara avatar Jul 09 '18 13:07 dansamara

For me it may be a different issue, but similar symptoms. In my case, i was calling .multiselect('refresh') indirectly from the onInitialized handler (as i needed to set my options dynamically and then refresh it.) - thought onInitialized is called from within the Multiselect constructor, whose return value is stored on the <select> node (but it has not returned yet, so it calls itself recursively because it checks if .data("multiselect") is set to determine whether it will create an instance or call a method on it.

rbeurskens avatar Dec 03 '19 18:12 rbeurskens