Sounds like all you need to do is something like this:
Event.observe($(id), "click", function() { /* put the function here
*/ });
Just make sure that the object which you're observing exists before you
call the above line. Oftentimes, all you need to do is this:
Event.observe(window, "load", function() {
Event.observe($(id), "click", function() { /* put the function
here */ });
});
which makes sure the element is loaded since the observation doesn't
begin until the page is completed. Read the Event section of the API
for more information ( http://prototypejs.org/api/event ).
-- Dash --
lsmith wrote:
> Hello,
>
> I want to trigger a "click" event on a tag. I only know the "id" of
> the tag, but it is necessary that the event be triggered from the
> given tag. Its not easily possible to just trigger the same thing
> directly due to how the event is implemented.
>
> regards,
> Lukas
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---