I want to bind myFunction with change or onchange event.
This is the function which I want to bind, inside my 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;
}
}
I am calling this function inside openModal() function:
function openModal() {
//
//some code here
//
$('#seconds').spinner({
spin: spinSeconds
});
}
I am using it as follows:
<div class="col-sm-9">
<input id="seconds" value=10 size=2 data-bind="value: PreExecWaitMin, event: {change: myFunction}" /> minutes
</div>
And I am facing with this error:
'Uncaught ReferenceError: Unable to process binding "event: function (){return {change:myFunction} }" Message: spinSeconds is not defined'
I've searched many event binding examples but could not handle it for my issue. Thanks for any help.