crop_rotate
Run
<!DOCTYPE html> <html> <head> <style> div { border: 1px solid black; margin: 5px; } </style> </head> <body> <p>Click the button to find out how many child nodes the div element below has.</p> <button onclick="myFunction()">Try it</button> <div id="myDIV"> <p>First p element (index 1)</p> <p>Second p element (index 3)</p> </div> <p><strong>Note:</strong> Whitespace inside elements is considered as text, and text is considered as nodes. In this example, index 0, 2 and 4 in DIV are text nodes.</p> <p id="demo"></p> <script> function myFunction() { var c = document.getElementById("myDIV").childNodes.length; document.getElementById("demo").innerHTML = c; } </script> </body> </html>
PCFET0NUWVBFIGh0bWw+DQo8aHRtbD4NCjxoZWFkPg0KPHN0eWxlPg0KZGl2IHsNCiAgYm9yZGVyOiAxcHggc29saWQgYmxhY2s7DQogIG1hcmdpbjogNXB4Ow0KfQ0KPC9zdHlsZT4NCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+IDo6LXdlYmtpdC1zY3JvbGxiYXJ7d2lkdGg6N3B4O2hlaWdodDo3cHg7fTo6LXdlYmtpdC1zY3JvbGxiYXItdHJhY2t7YmFja2dyb3VuZDojZmZmO306Oi13ZWJraXQtc2Nyb2xsYmFyLXRodW1ie2JvcmRlci1yYWRpdXM6NXB4O2JhY2tncm91bmQ6IzJmNDVmZjt9PC9zdHlsZT48L2hlYWQ+DQo8Ym9keT4NCg0KPHA+Q2xpY2sgdGhlIGJ1dHRvbiB0byBmaW5kIG91dCBob3cgbWFueSBjaGlsZCBub2RlcyB0aGUgZGl2IGVsZW1lbnQgYmVsb3cgaGFzLjwvcD4NCg0KPGJ1dHRvbiBvbmNsaWNrPSJteUZ1bmN0aW9uKCkiPlRyeSBpdDwvYnV0dG9uPg0KDQo8ZGl2IGlkPSJteURJViI+DQogIDxwPkZpcnN0IHAgZWxlbWVudCAoaW5kZXggMSk8L3A+DQogIDxwPlNlY29uZCBwIGVsZW1lbnQgKGluZGV4IDMpPC9wPg0KPC9kaXY+DQoNCjxwPjxzdHJvbmc+Tm90ZTo8L3N0cm9uZz4gV2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