onChange Event not Triggered

Please do check that in the Properties panel is the event also activated.

Or

you can also try out this method -

$w("#buttonid").onChamge(() => {
        // Your code here
});