Copyright © tutorialspoint.com

Prototype inspect() Method

previous next


Advertisements

This method returns the debug-oriented string representation of element. Prototype provides inspect methods for many types, both built-in and library-defined, such as in String, Array, Enumerable and Hash, which attempt to provide most-useful string representations for their respective types.

Syntax:

element.inspect();

Return Value:

Example:

<html>
<head>
<title>Prototype examples</title>

<script type="text/javascript" 
   src="/javascript/prototype.js">
</script>
<script>

function showResult(){
   var str = $('golden-delicious').inspect();
   alert("$('golden-delicious').inspect(): " + str );

   var str = $('mutsu').inspect();
   alert("$('mutsu').inspect() : " + str );

   var str = $('mutsu').next().inspect();
   alert("$('mutsu').next().inspect() : " + str );
}
</script>
</head>

<body>

  <p>Click the button to see the result.</p>

  <ul>
     <li id="golden-delicious">Golden Delicious</li>
     <li id="mutsu" class="yummy apple">Mutsu</li>
     <li id="mcintosh" class="yummy">McIntosh</li>
     <li</li>
  </ul>

  <br />
  <input type="button" value="Click" onclick="showResult();"/>

</body>
</html>

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


previous next

Copyright © tutorialspoint.com