简体   繁体   中英

jquery - multi-select dropdown and single select dropdown on same page?

I'm using the jQuery dropdown that was developed by Eric Hynds. Eric Hynds Multi-select

I want to have a multi-select dropdown and a single select dropdown on the page. I thought I could reference it this way:

 $(function () {

  $("select").multiselect({
    selectedList: 4
  });

  $("#ddlYear").multiselect({
    multiple: false,
    selectedList: 1
  });
});


 <div class="multiselectlist">
     <select id="msStatus" multiple="true" runat="server"/>
 </div>

 <div><select id="ddlYear" multiple="false" runat="server"/></div>

I populate the dropdowns from code-behind getting data from the database. Even though I set the single select (ddlYear) to not be multiple it still shows up as a multi-select dropdown.

Is there a way for the two type of dropdowns to exist on the same page? Thanks.

Try this,

$("#msStatus").multiselect({
    selectedList: 4
  });

  $("#ddlYear").multiselect({
    multiple: false,
    selectedList: 1
  });

You can stick with that plugins or you can use either of these 2 plugins

Jquery Plugins 1

Jquery Plugins 2

It seems there's an error on your script

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