JSFiddle - React, Tailwind, and code Playground
HTML
<label for="car">Car</label>
<select id="car" data-bind="options: cars, value: selectedCar, enable: checkCar"></select>
<label for="other">Other</label>
<input id="other" type="text" data-bind="value: other, valueUpdate:'afterkeydown'"/>
<p>Chosen value: <span data-bind="text: chosenCar"></span></p>
JavaScript
function viewModel(){
var self = this;
self.cars = ko.observableArray(["Chrysler", "Chevrolet", "Fuck You", "Lincoln"]);
self.other = ko.observable("");
self.selectedCar = ko.observable("");
self.chosenCar = ko.computed(function() {
return self.other() || self.selectedCar();
});
self.checkCar = ko.computed(function(){
if(self.other())
return false;
else
return true;
});
}
ko.applyBindings(new viewModel());