0

How do I get the particular element instance when an event is registered for multiple elements having same class ?

Code

Event.observe(document, 'dom:loaded', initBookingHistory); 

function initBookingHistory() 
{ 
    hideJourneyDetails(); 
    ObserveJourneyDetailsForClick(); 
} 

function ObserveJourneyDetailsForClick()
{ 
    $$('.Journey_Details div#Journey_Detail div.head h2 span.wrap').each(function(ele)
    { 
         Event.observe(ele,'click', showOrHideJourneyDetails(ele));
    }) 
} 

function showOrHideJourneyDetails(ele)
{ 
    ele.show(); 
}

Error

I get an "Handler is undefined" error

4

1 回答 1

0

Do you mean events like onClick? If that's what you think, you use onclick="do_something(this)"

于 2009-07-09T09:26:38.313 回答