Setting selectedIndex(-1) doesn’t update input field. I think that it should automatically clear input when setting selectedIndex to -1.
$(document).ready(function () { // View Model var listModel = function (items) { this.items = ko.observableArray(items); this.itemToAdd = ko.observable(""); this.disabled = ko.observable(false); this.selectedIndex = ko.observable(1); // adds new item. this.addItem = function () { if (this.itemToAdd() != "") { this.items.push(this.itemToAdd()); // Adds the item. Writing to the "items" observableArray causes any associated UI to update. this.itemToAdd(""); // Clears the text box, because it's bound to the "itemToAdd" observable } } .bind(this); // Ensure that "this" is always this view model // removes item. this.removeItem = function () { this.items.pop(); } // gets the selected index. this.getIndex = function () { alert("Selected Index: " + this.selectedIndex()); } // sets the selected index. this.setIndex = function () { this.selectedIndex(-1); } }; $("#list").on('bindingComplete', function (event) { }); ko.applyBindings(new listModel(["Caffé Latte", "Cortado", "Espresso"])); });