Just wrap in another function: .observe('click', function(){ deleteThis(param) });
-- kangax On Jul 2, 11:19 am, elduderino <[EMAIL PROTECTED]> wrote: > Ah What about in the event that i need to feed a parameter to the > function?? > like: .observe('click', deleteThis(param)); > > I wouldn't mind just running the funcion from here: > > var newCopy = new Element('div', { 'id' : obj.id, 'class' : > 'de_small' }).update(obj.innerHTML).observe('click', function{(...)}; > > (so just have the function code just after click...like above) ...but > i don't know if you can do it/get the syntax right > > On Jul 2, 12:15 pm, elduderino <[EMAIL PROTECTED]> wrote: > > > Yes taht's it....why the hell didn't it try that! > > > Thanks > > > On Jul 1, 8:19 pm, Frederick Polgardy <[EMAIL PROTECTED]> wrote: > > > > In other words, change: > > > > .observe('click', deleteThis()); > > > > To: > > > > .observe('click', deleteThis); > > > > You're passing deleteThis() as the value of your callback, which isn't > > > a function, but the return value of calling it. > > > > -Fred > > > > On Jul 1, 2008, at 2:09 PM, Matt Foster wrote: > > > > > Looking at this brief snippet I see one potential error, You're > > > > executing your callback, try sending just the reference. > > > > > On Jul 1, 11:21 am, elduderino <[EMAIL PROTECTED]> wrote: > > > > >>>> var newCopy = new Element('div', { 'id' : obj.id, 'class' : > > > >>>> 'de_small' }).update(obj.innerHTML).observe('click', deleteThis()); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---