Copyright © tutorialspoint.com
This method returns true if obj is a DOM node of type 1, false otherwise.
Object.isElement(obj); |
<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.
Copyright © tutorialspoint.com