Why does this error (jquery-1.7.1.js:3256 Uncaught TypeError: Object 50 has no method 'apply' Uncaught TypeError: Object 50 has no method 'apply'):
var func = function(foo) {
// some code
});
$('.some_class').keyup(func('bar'));
Many thanks :).
You’re passing the result of
funas the callback to be invoked. You want to send the function itself. Do this by wrapping it in an anonymous function: