Hello everyone, I''d like to have an onclick triggered by a href, but since href''s don''t have id''s, how do I use the Event.observe syntax with an href? <a href="#" class="jQJSLink" />Click me!</a> <script type="text/javascript" charset="utf-8"> Event.observe(''NOT-SURE-WHAT-TO-PUT-HERE'', ''click'', function () { Element.toggle($(''othercontent'')); }, false ); </script> Thanks for any help, Kevin -- Kevin Old kevinold-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
I''d like to have an onclick triggered by a href, but since href''s don''t have id''s, how do I use the Event.observe syntax with an href? Just put an ID on the href. It''s allowed.
On Wednesday 28 June 2006 14:12, Sam wrote:> > I''d like to have an onclick triggered by a href, but since href''s > > don''t have id''s, how do I use the Event.observe syntax with an href? > > Just put an ID on the href. It''s allowed.or, if you feel like finding the element some other way, use that. You can pass a node reference to the $() function and it will return it, id or no. -Jeremy -- Jeremy Kitchen ++ kitchen-RA8HwDor7flnDGu+y90WmgC/G2K4zDHf@public.gmane.org http://www.pirate-party.us/ -- defend your rights _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs