This is my jquery function which I call:
var spinSeconds = function(event, ui, id) {
if (ui.value >= 60) {
$(this).spinner('value', ui.value - 60);
$("#" + id).spinner('stepUp');
return false;
} else if (ui.value < 0) {
$(this).spinner('value', ui.value + 60);
$("#" + id).spinner('stepDown');
return false;
}
}
This is where I call it:
$('#seconds').spinner({
spin: spinSeconds(event, ui, "minutes")
});
When I try to pass id as an argument and call it like above, my function does not work and gives
"Uncaught ReferenceError: ui is not defined"
on console. What is the correct way to call it?
UPDATE:
You can see jsfidle here: https://jsfiddle.net/86Lwhmem/