views:

20

answers:

1

I have a link covering which contains an image and a paragraph on a page, there is another link is positioned over this one and has a higher z-index.

When I click the link the event handler for the link below is triggered.

How do I trigger the event handler for the above link?

Edit:

To be more specific, the link that is underneath is actually being handled by the event bubbling up to its container, and the container's handler is triggered.

The link that is above has code that is triggered by a handler that looks for its data-method attribute.

-- JavaScript
$$('.aList').invoke('observe', 'click', function(event) {
  var clickedItem = event.findElement('a');
  if (clickedItem) {
    var href = clickedItem.readAttribute('href');
    new Ajax.Updater('detail', href, {
      method: 'get'
    });
  }
  event.stop();
});

-- HTML
<a href="/items/1">
  <img src="/person.jpg" />
  <p>Michael Knight</p>
</a>
<a href="/items/1" class="delete" data-method="delete">Destroy</a>

N.B. The hanlder code for the delete link was not posted, but it is a standard click handler which searches for the data-method attribute.

A: 

Hi , Can you please post the code if possible you can always use id as unique way of trigering event handler. you can check the id at the run time also to find if that is the one you need or not

gov