Removing optionsCaption when an option is selected.

https://groups.google.com/d/topic/knockoutjs/wEmPPwn-uyk/discussion

by Geo Morillo

HTML

<select data-bind="options: myOptions, optionsCaption: caption(), value: selectedValue"></select>

CSS

ul { margin-left: 15px; }

JavaScript

var viewModel = {
    myOptions: ["one", "two", "three"],
    selectedValue: ko.observable()
};

viewModel.caption = ko.dependentObservable(function() {
    if (!this.selectedValue()) {
        return "Choose one..."; 
    }
}, viewModel);

ko.applyBindings(viewModel);