truckingsim / Ajax-Bootstrap-Select

This uses the bootstrap-select plugin and extends it so that you can use a remote source to search.
MIT License
280 stars 97 forks source link

How to have a deselect option? #174

Closed martabelfm closed 4 years ago

martabelfm commented 5 years ago

When selection is done, and I would like to select empty option, as nothing selected, how could this be done?

markhalliwell commented 4 years ago
$('select').selectpicker('val', '');
ppazos commented 3 years ago

@markhalliwell I'm actually selection an empty option manually and the previously selected value appears on the select. If I try to execute that code in the changed.bs.select I get the error "too much recursion", because the selectpicker('val', '') triggers also the event.

How can I select an empty option and make an empty string appear on the select?

BTW if I remove the ajax plugin and keep the bootstrap-select, selecting the empty option works OK.