3
我有以下的下拉菜單:預選項目與淘汰賽
<div>
Dummy
<select data-bind="options: categories, optionsText: 'description', value: 2"></select>
</div>
下面的JavaScript:
function ViewModel()
{
this.categories = ko.observableArray([
new Category(1, "Non classé"),
new Category(2, "Non nucléaire"),
new Category(3, "Classe II irradié"),
new Category(4, "Classe III")
]);
// Constructor for an object with two properties
function Category(id, description) {
this.id = id;
this.description = description;
};
}
ko.applyBindings(new ViewModel());
我想用2號預選擇元素在下拉菜單中。
任何想法?
謝謝。
的jsfiddle:http://jsfiddle.net/RfWVP/276/我能想到的