Tutorials Point


  Learn Prototype
  Prototype Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

Prototype Object isElement() Method


previous next AddThis Social Bookmark Button


Advertisements

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

Syntax:

Object.isElement(obj);

Return Value :

  • Returns true if passed object is is a DOM node of type 1 otherwise returns false.

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 Printer Friendly

Advertisements


  

Advertisements