I want to use jquery delegate to call a function, and this works fine:
$("body").delegate("div", "mouseover", function(){
alert("it works");
});
But I also want to be able to use the same function elsewhere. So rather than writing the same function out several times, I can just declare it separately, and call it by name, right?
But written this way, I never see the alert.
function alertMe(){
alert("it works");
};
$("body").delegate("div", "mouseover", alertMe());
Drop the parenthisis while defining delegate. just give the function-name