I am new to this knockout js and MVVM architecture. Am not able to retrieve dynamically created textbox values on button click event.
Code:HTML
<div data-bind="foreach: cources">
<input type="text" data-bind="value: textValue"/>
<br>
</div>
<input type="button" data-bind="click:retrieve" value="Value"/>
Code:js
function CourseViewModel(){
textValue = ko.observable('');
}
var ViewModel= {
cources : ko.observableArray([new CourseViewModel()]),
retrieve: function()
{
var abc = $.parseJSON(ko.toJSON({ textValue: ViewModel.cources}));
alert(abc.textValue());
}
}
ko.applyBindings(ViewModel);