Klaus Hartl wrote:
> Another pattern for this would be a function that returns a function
> (or maybe you meant that with "dynamic function"):
>
> function myFunction(s) {
>     return function() {
>         $(this).append(s);
>     };
> }
>
> $('#hoverelem').hover(myFunction('foo'), myFunction('bar'));

Ah, even better!

This combined with event bubbling could be really a useful way to create 
general easy to use functions for various tasks that need to be bound only 
to certain top level elements, while still providing full parameter 
functionality to all child elements, regardless of if they are loaded in/out 
with ajax during use.

Excellent.

-- 
Suni 


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to