[jQuery] Re: anonymous function and code reusing

2009-06-14 Thread Mirko Galassi
Interesting someone has suggested it $("#moon").click(myFunction("param")); $("#earth").click(myFunction("param2")); it involves less code, and it is probably faster because doesn't have condition statements that need to be executed. Do you agree? waseem sabjee ha scritto: function re

[jQuery] Re: anonymous function and code reusing

2009-06-13 Thread Mirko Galassi
} }); use $(document).ready(function(){ $("#moon").click(function() { myFunction("param"); }); $("#earth").click(function() { myFunction("param2"); }); }); function myFunction(param){ alert(param); } On Jun 13, 12:07 pm, Mirko Galassi wrote: H

[jQuery] anonymous function and code reusing

2009-06-13 Thread Mirko Galassi
Hi guys, apologize for posting again the same topic. I haven't found a solution yet for my simple problem. I have a simple function that works when a link is clicked $(document).ready(function(){ $("#moon").click(function(){ alert("do something"); }); }); I need to reuse that functio