Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap Selectpicker problems

I'm trying to use this selectpicker for form selects and options, but can't get it to work.

I've added the following scripts and css as specified:

    <script type="text/javascript">
    $('.selectpicker').selectpicker({
      });
    </script>

<script src="/js/Bootstrap/Select/bootstrap-select.js"></script>

html for the 1st greyed out select in the search bar:

<select class="selectpicker" id="searchType" name="searchtype" onchange="this.form.submit()">
            <option value="All">All</option>
            <option value="Businesses">Businesses</option>
            <option value="Events">Events</option>
            <option value="News">News</option>
            <option value="Lifestyle">Lifestyle</option>

        </select>

Any ideas appreciated.

like image 974
321 Avatar asked Jul 30 '26 12:07

321


1 Answers

Please be sure that you included all the required files or You may have to rearrange the code like :

<script src="/js/Bootstrap/Select/bootstrap-select.js"></script>

<script type="text/javascript">
    $('.selectpicker').selectpicker({
      });
</script>

You need to include the js first then call the the plugin. Check this fiddle, its working for me : http://jsfiddle.net/tejashsoni111/RUAS4/

like image 148
tejashsoni111 Avatar answered Aug 02 '26 00:08

tejashsoni111



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!