You are not assigning a function to keyup
and blur
, you're assigning the result of the execution of myFunction
.
Change it like this:
$('#input1').on({
keyup: function() { myFunction('keyup'); },
blur: function() { myFunction('blur'); },
focus: function() { console.log('focus!'); }
});