I have a dropdown working nice:
<select class="picker-select" data-bind="options: searchOptions, select:{}, optionsText: 'name', optionsValue: 'id', value: selectedSearchOption" ></select>
Now I want to execute a function when selection changes but it does not seem to work.
What I've tried:
onchange="actionWhenChange()" // also tried without parenthesys
MODEL:
function actionWhenChange(event) {
console.log("doing stuff");
};
ERROR:
Uncaught (in promise) ReferenceError: actionWhenChange is not defined
And with knockout event
binding (also tried without parenthesys)
data-bind="event: { onchange: actionWhenChange() }, ... more bindings
MODEL:
self.actionWhenChange = function (event) {
console.log("doing stuff");
}
But I get no error.
Any ideas?