Title option (placeholder) not working when select element has at least one optgroup element
When there is at least one optgroup among the children of the select, the title option (the placeholder text that appears in the select element when it has no value set) stops working and the placeholder takes the value of the first option repeated as many times as there are optgroups.
In a select without optgroup, however, the title option is honored and works correctly.
As a dirty workaraound it is possible to append an <option hidden selected></option> in the option's childerns.
Version used
- bootstrap-select 1.14.0-beta2
- bootstrap 5.1.3
- jquery 3.6.0
Minimal, Reproducible Example
https://jsfiddle.net/pesa27k0/
This is fixed in v1.14.0-beta3.
Thank you for reaching out. However, this is still not fixed in 1.14.0-beta3 (as of https://github.com/snapappointments/bootstrap-select/commit/04cc1fd5abedc85c449d159d9fa6ea48e2e4a2f7): jsfiddle
Ah, you're right - sorry, I misread your description.