dom - Get particular child node class name javascript -
i want particular child node(i.e. want div). how can this. code
<html> <head> </head> <body> <div id="test"> <input type="text"> <div class="nod1"></div> <input type="text"> <div class="nod2"></div> </div> </body> <script> var tst=document.getelementbyid('test'); var childrens=tst.children; for(var i=0; i<childrens.length; i++){ console.log(childrens[i]); } </script> </html>
try this
for(var i=0; i<childrens.length; i++){ console.log(childrens[i].classname); }
Comments
Post a Comment