[jQuery] Re: Passing parameters to callback functions

2008-04-17 Thread Gauthier Segay
in your exemple, you can simply remove the parameter since the function is declared as a closure that capture your var $id. In most cases, callback function doesn't have any parameter, unless explicitely specified in the documentation. If you need to pre-bind parameters to your callback function

[jQuery] Re: Passing parameters to callback functions

2008-04-16 Thread Richard D. Worth
There's no need to pass it. Since var $id and your callback are in the same function-scope, a closure provides access. Here's a simpler example to illustrate: $(document).ready(function() { var i = 3; $("div").click(function() { alert(i); // i and div.click fn are in the same function scop

[jQuery] Re: Passing parameters to callback functions

2008-04-15 Thread Donald J Organ IV
Please ignore the fact that the single quotes are being escaped. Thanks Donald wrote: > Is i possible to pass arguments to callback functions right now I > have: > > $(".imagethumb").each(function() { > $(this).bind( \'click\', function() { > var $id = $(this)[0].id; > $("#pr