Using event-related attributes in the HTML is a "strong sin" anyway
(it''s *not* unobstrusive JS). The proper way to do that is to write
your own script (you don''t go putting custom stuff in libs, stef!), but
you have to wait until your DOM is loaded so as to be sure your
elements are available. Here''s a typical excerpt:
[CODE]
// Code for your own event handlers, say mySubmitHandler and
toggleListDisplay.
// Both will receive an event object as first arg, that Event.xxx
methods can act on.
function bindEvents() {
Event.observe(''myForm'', ''submit'',
mySubmitHandler);
Event.observe(''myToggler'', ''click'',
toggleListDisplay);
}
Event.observe(window, ''load'', bindEvents);
[/CODE]
Easy as pie, rock safe.
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---