Skip to content
Advertisement

Dropdown with Search Box using Bootstrap Selectpicker not working

I’m trying to search for supplier from the database using the bootstrap-select picker on the dropdown. What I want is while typing in a letter, the dropdown shows the relevant name from the database. The problem is, when I click the search bar, it doesn’t show me the list of suppliers in the dropdown. what went wrong? I was able to see the list of suppliers in the dropdown before adding in the data-live-search and the select picker class.

JavaScript

Advertisement

Answer

Since you haven’t provided any of your other code, I would assume you are properly including all required files – jquery, boostrap js and css. I would also assume your php code works and generates the required html. That being said, please examine the below snippet. I reproduced your error and examined the source code – it had all items in the DOM but was not showing any of them. According to the documentation the size parameter determines how may items are shown:

JavaScript

Setting size: false seems to have resolved the issue.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement