Copyright © tutorialspoint.com
Collects all of the element's children and returns them as an array of extended elements.
An index of 0 refers to the topmost child of element.
element.childElements(); |
<html>
<head>
<title>Prototype examples</title>
<script type="text/javascript"
src="/javascript/prototype.js">
</script>
<script>
function showElements(){
var arr = $('father').childElements();
arr.each(function(node){
alert(node.nodeName + ': ' + node.innerHTML);
});
}
</script>
</head>
<body>
<div id="father">
<p id="kid1">This is first paragraph</p>
<p id="kid2">This is second paragraph</p>
</div>
<br />
<input type="button" value="showElements"
onclick="showElements();"/>
</body>
</html>
|
To understand it in better way you can Try it yourself.
Copyright © tutorialspoint.com