I have developed many applications with javascript and knockout.js but this time I am so much confused now. As we all know that Knockout is works on MVVM pattern (i.e dual binding). Lets take a example for my confusion: I have a viewModel:
var myViewModel = {
firstName: ko.observable('Bob'),
lastName: ko.observable('dev')
};
ko.applyBindings(new myViewModel());
and I have bound the above viewModel
to two text boxes like:
<p>First name: <strong data-bind="text: firstName"></strong></p>
<p>Last name: <strong data-bind="text: lastName"></strong></p>
<p>First name:</p><input type="text" data-bind="value: firstName" />
<p>Last name:</p><input type="text" data-bind="value: lastName " />
Now this sample observable code works for me. When I change the values from script or in the input boxes, they will be bound.
Now I want to do this same task with only basic javascript. How can I do this? Any help will be appreciated.