So if I wanted to call a function with knockout’s data-bind=”click: ShowHide” how would i go about that?
keep in mind the data-bind is on an li element, which is being populated by a template. my function was as follows:
viewModel = {
LoadedReports: ko.observableArray([]),
ShowHide: function() {
$(this).children().slideToggle('slow');
}
}
and within my template I have :
<li data-bind="click: ShowHide, clickBubble: false"><'children elements being populated'></li>
Got this one myself the other day. See the comment on Judah H.’s suggestion for what I had to do.