Search code examples
javascripthtmltwitter-bootstrapbootstrap-select

Always show one text in Bootstrap-select


<select class="selectpicker" multiple title="Not changable text">
     <option>Mustard</option>
     <option>Ketchup</option>
     <option>Relish</option>
</select>

So there are bootstrap-select(multiple).

Is it possible not to change title when user something check/select?

Behaviour like in Bootstrap dropdown.

Example : jsFiddle


Solution

  • Without any JS :

    Fiddle : http://jsfiddle.net/re8tevoc/1/

     <select class="selectpicker" multiple title="Not changable text" data-show-content data-count-selected-text="Not changable text" data-selected-text-format="count>0">
             <option data-content="">Mustard</option>
             <option data-content="">Ketchup</option>
             <option data-content="">Relish</option>
     </select>
    

    Update

    Sorry , my code was with not usefull attributes... Just add data-count-selected-text="Not changable text" data-selected-text-format="count>0"

    Fiddle : http://jsfiddle.net/re8tevoc/2/

    Code :

     <select class="selectpicker" multiple title="Not changable text" data-count-selected-text="Not changable text" data-selected-text-format="count>0">
             <option>Mustard</option>
             <option>Ketchup</option>
             <option>Relish</option>
     </select>