JSFiddle - React, Tailwind, and code Playground
by sellmeadog
HTML
<input data-bind="value: station" />
<select data-bind="options: stations, value: selectedStation"></select>
<button data-bind="click: clearSelectedStation">Clear</button>
JavaScript
var ClearSelectionViewModel = function () {
var self = this;
self.station = ko.observable();
self.selectedStation = ko.observable();
self.stations = ko.observableArray(['CLT', 'PHL', 'PHX', 'PIT']);
self.clearSelectedStation = function () {
self.selectedStation(null);
};
};
ko.applyBindings(new ClearSelectionViewModel());