<p>Is there a way to test the type of an element in JavaScript? </p>

<p>The answer may or may not require the prototype library, however the following setup does make use of the library.</p>

<pre><code>function(event) {
  var element = event.element();
  // if the element is an anchor
  ...
  // if the element is a td
  ...
}
</code></pre>

```
```
if (element.nodeName == "A") {
 ...
} else if (element.nodeName == "TD") {
 ...
}
```
```