Re: [jQuery] passing functions

2006-12-12 Thread Klaus Hartl
dmoshal schrieb: Karl, using object literals seems to work: var a = { foo: function() { } } function bar (a) { $(elem).click (a.foo) } bar (a) Dave And that of course is exactly the same as this: function foo() { } function bar(a) {

Re: [jQuery] passing functions

2006-12-12 Thread dmoshal
That's what I tried initially - though for some reason didn't seem to work! Out of interest - what technique are folks using to create the dom elements? raw HTML? domBuilder? Dave Klaus Hartl wrote: dmoshal schrieb: Karl, using object literals seems to work: var a = { foo:

Re: [jQuery] passing functions

2006-12-12 Thread 齐永恒
Hi in jQuery bug list, i find in IE, ajaxStart return the error NULL, please tell me the bug was closed? and i use 1.0.3, the ajaxStart is not Work. yours 齐永恒 ___ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/

Re: [jQuery] passing functions

2006-12-12 Thread rn Zaefferer [EMAIL PROTECTED]
齐永恒 schrieb: Hi in jQuery bug list, i find in IE, ajaxStart return the error NULL, please tell me the bug was closed? and i use 1.0.3, the ajaxStart is not Work. Bug reports are closed as soon as they are fixed. It takes a while to get the change into a new release. You have to check out

[jQuery] passing functions

2006-12-11 Thread dmoshal
Hi, Firstly - wow, what an amazing piece of work - Kudos! I've been more productive with jQuery in a day than I've been with YUI, and GWT in weeks. Question: how does one pass a function into jQuery, ie given: function foo(){} I want to assign it to the element's onclick handler:

Re: [jQuery] passing functions

2006-12-11 Thread Aaron Heimlich
On 12/11/06, dmoshal [EMAIL PROTECTED] wrote: given: function foo(){} I want to assign it to the element's onclick handler: $(elem).click (foo) which doesn't seem to work? Well, that *should* work. Are you sure that there aren't any scope issues at play here? What kind of error messages

Re: [jQuery] passing functions

2006-12-11 Thread Karl Rudd
That should work. You'll need to show us code that is a little more specific. Karl Rudd On 12/12/06, dmoshal [EMAIL PROTECTED] wrote: Hi, Firstly - wow, what an amazing piece of work - Kudos! I've been more productive with jQuery in a day than I've been with YUI, and GWT in weeks.

Re: [jQuery] passing functions

2006-12-11 Thread dmoshal
thanks for the prompt responses. the problem in more detail: function bar(f) { $(elem).click (f) } bar (new foo()) results in this error in Firebug: - c[j].apply is not a function handle(click clientX=0, clientY=0) [Break on this error] if ( c[j].apply( this, args ) ===

Re: [jQuery] passing functions

2006-12-11 Thread dmoshal
Karl, using object literals seems to work: var a = { foo: function() { } } function bar (a) { $(elem).click (a.foo) } bar (a) Dave Karl Rudd wrote: That should work. You'll need to show us code that is a little more specific. Karl Rudd On 12/12/06, dmoshal

Re: [jQuery] passing functions

2006-12-11 Thread Blair McKenzie
I assume foo is a function? Remember that fn != foo() != new foo(). Instead of bar (new foo()) try bar (foo) Blair On 12/12/06, dmoshal [EMAIL PROTECTED] wrote: thanks for the prompt responses. the problem in more detail: function bar(f) { $(elem).click (f) } bar (new foo()) results

Re: [jQuery] passing functions

2006-12-11 Thread Aaron Heimlich
On 12/11/06, dmoshal [EMAIL PROTECTED] wrote: function bar(f) { $(elem).click (f) } bar (new foo()) You're passing an object into bar, not a function -- Aaron Heimlich Web Developer [EMAIL PROTECTED] http://aheimlich.freepgs.com ___ jQuery

Re: [jQuery] passing functions

2006-12-11 Thread bmsterling
I had to do something similar today, and I did something like function myfunction(f){ $(element).click(function(){eval(f+(););}); } that was off the cuff, but that should work. -- View this message in context: http://www.nabble.com/passing-functions-tf2805241.html#a7827322 Sent from the

Re: [jQuery] passing functions

2006-12-11 Thread dmoshal
Excellent, didn't think of that one thx Dave bmsterling wrote: I had to do something similar today, and I did something like function myfunction(f){ $(element).click(function(){eval(f+(););}); } that was off the cuff, but that should work. -- View this message in context:

Re: [jQuery] passing functions

2006-12-11 Thread Aaron Heimlich
If you don't mind my asking, what exactly are you trying to do? You shouldn't need all this hackery just to pass function references around. On 12/11/06, dmoshal [EMAIL PROTECTED] wrote: Excellent, didn't think of that one thx Dave bmsterling wrote: I had to do something similar today,

Re: [jQuery] passing functions

2006-12-11 Thread Michael Geary
I had to do something similar today, and I did something like function myfunction(f){ $(element).click(function(){eval(f+(););}); } that was off the cuff, but that should work. That would be the ticket if f is a string containing the name of a function. But why not just pass a