Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select picker bootstrap change noneSelectedText

Is it possible to change the message of a select picker, if nothing is selected. For now, 'Nothing selected' is written. I know, the noneSelectedText attribute contains that message.

But I dont want to change it in the bootstrap.select.js. I want to change it dynamically, because I use different select pickers at different locations.

Edit:

Thank you, it works :)

like image 946
Makuna Avatar asked Jul 30 '15 05:07

Makuna


2 Answers

Set title attribute to your selects.

<select multiple title="Empty" class="selectpicker">     <option>1</option>     <option>2</option>     <option>3</option>     <option>4</option> </select>  <select multiple title="No Value" class="selectpicker">     <option>1</option>     <option>2</option>     <option>3</option> </select> 
$('.selectpicker').selectpicker(); 

JSFiddle

like image 146
Mariya Steksova Avatar answered Sep 22 '22 21:09

Mariya Steksova


with help of - this I tried it works .

1st step - we have to add data-none-selected-text attribute in Html select tag. example -

<select name="your_sel_name" multiple class="form-control selectpicker" data-selected-text-format="count" data-none-selected-text > 

2nd Step - in js on page load use noneSelectedText option
example -

$(".selectpicker").selectpicker({         noneSelectedText : 'Please Select' // by this default 'Nothing selected' -->will change to Please Select     }); 

Hope it will Help some-one Thanks!

like image 39
Anurag_BEHS Avatar answered Sep 20 '22 21:09

Anurag_BEHS