<h3>Products</h3> <ul data-bind="foreach: products"> <li> <strong data-bind="text: name"></strong> <button class="remove-item">Remove</button> </li> </ul>
function appViewModel() { this.products = ko.observableArray([ { name: "XBox" }, { name: "PlayStation" }, { name: "Banana" }, { name: "Wii" } ]); }; var myViewModel = new appViewModel(); ko.applyBindings(myViewModel); $(".remove-item").live("click", function() { myViewModel.products.remove(ko.dataFor(this)); });