I have a solution for using an optgroup with my SELECT html tag.
Here is the SO post: Construct a knockout SELECT with optgroup based on observableArray
Now I would like to allow an empty value in this SELECT. I try with optionsCaption:
<select data-bind="foreach: brands, optionsCaption: ' '">
<optgroup data-bind="attr: {label: $data}, foreach: $parent.vehicles">
<!-- ko if: Brand == $parent -->
<option data-bind="text: Type"></option>
<!-- /ko -->
</optgroup>
</select>
But it doesn't work: no empty option.
Any idea?
Thanks.