Michael,
"var elem = $('frm');" will not throw error if element with id of
"frm" does not exist. It will assign null to "elem" variable.
Justin's example will work as expected and is one of the preferred
ways to check for element existence.
Alternatively, Element.observe('frm', 'submit', handler) will fail
*silently* if element is not present.
I would avoid using "try ... catch" as it happens to be quite
expensive (speed wise)
Hope this helps.
Best,
kangax
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---