element :: Event

Event.element(event) -> Element

 

Returns the DOM element on which the event occurred.

 

Note that if the browser does not support native DOM extensions (see this page for further details), the element you’ll get may very well not be extended. If you intend to use methods from Element.Methods on it, wrap the call in the $() function.

 

Example

 

Here’s a simple code that lets you click everywhere on the page and, if you click directly on paragraphs, hides them.

 

Event.observe(document.body, 'click'function(event) {

  var elt = Event.element(event);

  if ('P' == elt.tagName)

    $(elt).hide();

});

 

See also

 

There is a subtle distinction between this function and findElement.

 

Event: findElement


Prototype API 1.5.0 - prototypejs.org