Prototype Event findElement() Method
This method returns the first DOM element with a given tag name, upwards from the one on which the event occurred.
Sometimes, you're not interested in the actual element that got hit by the event. Sometimes you're interested in its "closest element". This is what findElement is for.
The provided tag name will be compared in a case-insensitive manner.
- Returns the first DOM element with a given tag name. If no matching element is found, the document itself (HTMLDocument node) is returned.
Here's a simple code that lets you click everywhere on the page and hides the closest-fitting paragraph around your click (if any).
To understand it in better way you can Try it yourself.