JSFiddle - React, Tailwind, and code Playground

by imbolc

HTML

<select data-bind="value: val, options: opts, optionsText: 'name', optionsValue: 'id'"></select>

JavaScript

var vm = {
    opts: [{id: 1, name: 'a'}, {id: 2, name: '2'}],
    val: ko.observable(1)
};
vm.val.subscribe(function (x) {
    console.log(x, typeof x);
});
ko.applyBindings(vm);