Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

279
Views
Javascript Bootstrap Multiselect - Show search dropdown if no options available

I'm using bootstrap-multiselect (https://github.com/davidstutz/bootstrap-multiselect) and want to dynamically load the data similar to bootstrap multiselect search get value from database, but on initial start there are no option values available, then by default the search dropdown is not showing. How can I still open/show the search dropdown if no options are available? Here is a fiddle: https://jsfiddle.net/mwd4ag3h/

html:

<select id="example-getting-started" multiple="multiple"></select>

js:

$('#example-getting-started').multiselect({
    enableFiltering: true,
    includeFilterClearBtn: true,
    enableCaseInsensitiveFiltering: true
});

/* Here you have a search field */
var data_loader = [
    { label: "Dashboard", value: 1 },
    { label: "Email", value: 2 }
];

/* Here you don't have a search field */
var data_loader_empty = [];

$('#example-getting-started').multiselect('dataprovider', data_loader_empty);
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

A possible solution is to add an element to the multiselect and then hide the list item

let $select = $('#example-getting-started').multiselect({
  //includeSelectAllOption: false,
  enableFiltering: true,
  includeFilterClearBtn: true,
  enableCaseInsensitiveFiltering: true
});
var data_loader = [{label:'', value:''}];
$('#example-getting-started').multiselect('dataprovider', data_loader);
$('.multiselect-container li').hide();
about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!