我有帶有data_bind =「checked」綁定的單選按鈕。我需要調用自定義函數來定製用戶界面時,其中一個單選按鈕檢查。 的Html我怎樣才能在data_bind =「checked」綁定中運行javascript函數
每日 每週 每月<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 如何與淘汰賽做呢?
這是不是真的清楚你想打電話什麼js功能,以及什麼時候?當'FrequencyType()== 3'或'visible'綁定之前被觸發? – nemesv
組件將可見後 –