I'm trying to do something like this but this doesn't seem to work.
function myEvent(callback){
console.log("Do Stuff");
callback(); // Then execute callback function
}
$("#myBtn").on("click", myEvent(function(){
console.log("My anonymous callback");
}));
Basically I need a named event so that I can easily add and remove the event as needed. But I also need to be able to pass a callback to the function that event uses. This function needs to be an anonymous function. Is this possible?
Jquery solutions preferred.