Copyright © tutorialspoint.com

Prototype Object isElement() Method

previous next


Advertisements

This method returns true if obj is a DOM node of type 1, false otherwise.

Syntax:

Object.isElement(obj);

Return Value :

Example:

<html>
<head>
<title>Prototype examples</title>
<script type="text/javascript" 
   src="/javascript/prototype.js">
</script>

<script>

function showResult(){

   alert( "1: " + Object.isElement(new Element('div')) );
   alert( "2: " + Object.isElement(document.createElement('div')) );
   alert( "3: " + Object.isElement(document.createTextNode('foo')) );
   alert( "4: " + Object.isElement($('para')) );

}

</script>
</head>

<body>

  <p id="para">Click the button to see the result.</p>
  <br />
  <br />
  <input type="button" value="Result" onclick="showResult();"/>

</body>
</html>

To understand it in better way you can Try it yourself.


previous next

Copyright © tutorialspoint.com