Question

There is an attribute [multiple title] according silvio bootstrap-select documentation:

Here is documentation: https://github.com/silviomoreto/bootstrap-select

<select class="selectpciker" multiple title='Choose one of the following...'>
<option>1</option>
<option>1</option>
</select>

It works well! But I need a single select ( not multiple ) . [title] attribute doesn't works without [multiple] attribute.

I didn't find a single title attribute in silvio bootstrap-select documentation.

Could anyone help me ?

Was it helpful?

Solution

You can use the data-hidden attribute on the first option..

<select class="selectpicker">
    <option data-hidden="true">Choose one</option>
    <option value="one">One</option>
    <option value="two">Two</option>
    <option value="three">Three</option>
</select>

Working demo: http://www.bootply.com/124596

OTHER TIPS

This one is work for me and i wish it's work 100% for you also this is done by the title attribute

           <select name="action" id="ActionOnUser" class="selectpicker" title="Action" data-width="auto">
                   <option data-hidden="true"></option>
                   <option value="0">Active</option>
                   <option value="1">Disable</option>
                   <option value="2">Invite Pending</option>
           </select>

The following works for me with the title attribute

<select title="Choose One of the following" "class="selectpicker">
    <option>One</option>
    <option>Two</option>
    <option>Three</option>
</select>

Try this

  <select class="selectpciker">
    <option>Choose one of the following...</option>
    <option>Option1</option>
    <option>Option2</option>
    </select>

To set the title to a single bootstrap-select, you should use the data-title attribute.

<select class="selectpicker" data-title="My Title">
    <option>Option 1</option>
    <option>Option 2</option>
    <option>Option 3</option>
</select>

For more information, see the bootstrap-select Options section

This solution works for me

<select multiple data-max-options="1" id="Choice" class="selectpicker form-control" title="What is your choice?" >
<option value="No">No</option>
<option value="Maybe">Maybe</option>
<option value="Yes">Yes</option>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top