I have radiobuttons with data_bind = “checked” binding. I need to call custom function to customize ui when one of the radiobuttons checked.
Html
Daily
Weekly
Monthly
<div data-bind="visible: FrequencyType() == 1">
Message 1
</div>
<div data-bind="visible: FrequencyType() == 2">
Message 2
</div>
<div data-bind="visible: FrequencyType() == 3">
//Before show html here I want to call js function
</div>
js
function AppViewModel() {
this.FrequencyType = ko.observable("0");
}
$(document).ready(function () {
viewModel = new AppViewModel();
// Activates knockout.js
ko.applyBindings(viewModel);
});
jsfiddler
How can I do it with knockout?
The easiest way to do this is to create a manual subscription on
FrequencyType.http://jsfiddle.net/jearles/TuBzb/1/