getElementByTagName does not return comment nodes in javascript
- by Sourabh
Hi ,
I want to retrieve all the nodes present in particular DIV element.see the below test page
(firefox)
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script>
function processTags()
{
var chNodes = document.getElementById('foo').getElementsByTagName('*') ;
console.log(chNodes);
}
</script>
</HEAD>
<BODY onload="processTags();">
<div id="foo">
<!-- this is a comment -->this is some text ? <span>this is inside span</span>
<div><p>test</p>test<div>
</div>
</BODY>
</HTML>
But it does not give me comments tag.. what is the best way to retrieve all tags ??