I’m using knockoutjs to bind data to table, and I want to update object at user click. Here is my code
var Books = [{Book:"Harry Potter",Author:"J.K rowling"},{Book:"5 Point Someone",Author:"Chetan Bhagat"},{Book:"I too had a love story",Author:"Ravinder Singh"}];
var appViewModel = function() {
this.firstName = ko.observable("Amit");
this.Books = ko.observableArray([]);
this.Books(Books);
this.updateBook = function() {
this.Book("Harry Potter and Prisoner of Azkaban");
}
};
ko.applyBindings(appViewModel);
But it get error: “Uncaught TypeError: string is not a function”. How can fix it ?
See: http://jsfiddle.net/jVQY8/8/
Source: jquery