I have the following HTML code that binds a list of members from a JSON call. This works fine, however I am now want to find a row based on a MemberId and change the name in code.
<ul data-bind="foreach: { data: members}">
<li>
<span data-bind="text: $index"></span>
<span data-bind="text: $data.Name"></span>
<span data-bind="text: $data.MemberId"></span>
</li>
</ul>
<button id="btnChange">Change</button>
<script>
$(function () {
$.getJSON("/home/memberlist", function(data) {
var viewModel = {
members: ko.observableArray(data),
};
ko.applyBindings(viewModel);
});
$('#btnChange').click(function() {
//I would like to find the row that is a match for a MemberId
// and change the name....
});
});
</script>