myFunction を change または onchange イベントにバインドしたい。
これは、ViewModel 内でバインドしたい関数です。
myFunction: function spinSeconds(event, ui) {
if (ui.value >= 60) {
$(this).spinner('value', ui.value - 60);
$('#minutes').spinner('stepUp');
return false;
} else if (ui.value < 0) {
$(this).spinner('value', ui.value + 60);
$('#minutes').spinner('stepDown');
return false;
}
}
私は openModal() 関数内でこの関数を呼び出しています:
function openModal() {
//
//some code here
//
$('#seconds').spinner({
spin: spinSeconds
});
}
私は次のように使用しています:
<div class="col-sm-9">
<input id="seconds" value=10 size=2 data-bind="value: PreExecWaitMin, event: {change: myFunction}" /> minutes
</div>
そして、私はこのエラーに直面しています:
'Uncaught ReferenceError: Unable to process binding "event: function (){return {change:myFunction} }" Message: spinSeconds is not defined'
多くのイベント バインディングの例を検索しましたが、私の問題では処理できませんでした。助けてくれてありがとう。