Give this a try:
playSelection: function(event) {
var clicked = Event.findElement(event, ''li'');
console.log(clicked + '' class '' + clicked.className);
}
This way the prototype walks up the DOM till it finds a ''li''
element.
Greetz,
Wizz
On 16 aug, 05:36, Matt
<matthieu.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> Hi guys,
>
> I''m using Prototype 1.5.1.1 (didn''t upgrade yet but soon)
and am
> registering a click event on the following element:
>
> <li id="pl_2"><div class="song_text">Muse -
Take a Bow</div><div
> id="trash_2"
class="song_trash"></div></li>
>
> I register my event on the <li>:
>
> this.onclickListener >
playlistHandler.playSelection.bindAsEventListener(this);
> Event.observe(''pl_2'', ''click'',
this.onclickListener);
>
> However when I click on the line rendered by the <li>, the element I
> get as the event source is the child (the "song_text" div):
>
> playSelection: function(event) {
> var clicked = Event.element(event);
> console.log(clicked + '' class '' +
clicked.className); // ->
> [objectHTMLDivElement] class song_text
> }
>
> It could be the normal behavior but it''s a bit surprising. Did I
> overlook something (highly possible)?
>
> Thanks!
> Matthieu
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---