JSFiddle - React, Tailwind, and code Playground
by tyrsius
HTML
<span data-bind="click:change">Click me</span>
<select data-bind="options: PaidByUserOptions, value:SelectedOption, optionsText:'Id' " class="grey-border">
</select>
JavaScript
// Class to represent a row in the seat reservations grid
var ReservationsViewModel = function(){
var self = this;
this.PaidByUserOptions = ko.observableArray([{Id:"x"},{Id:"y"},{Id:"z"}]);
this.SelectedOption = ko.observable();
this.change = function(){
self.SelectedOption(self.PaidByUserOptions()[0]);
}
}
ko.applyBindings(new ReservationsViewModel());