0

This is my code, I want to get childNodes and loop create these tag, But print 2 in IE8

<!DOCTYPE html>
<html>
<head>
    <title></title>
</head>
<body>
    <div id="div"></div>
    <script type="text/javascript">
        var div = document.getElementById('div');
        var code = '<script>alert("hello");<\/script><div>dsd<\/div><script>alert("hi");<\/script>';
        div.innerHTML = code;
        console.log(div.children.length);
        console.log(div.childNodes.length)
    </script>
</body>
</html>
weiwei
  • 123
  • 1
  • 1
  • 4
  • Presumably there is a compelling reason to bother with IE8? - See if it works without the ` – Alex K. Jun 12 '17 at 12:25
  • @AlexK. Thank's, This is my code `code.replace(/ – weiwei Jun 29 '17 at 13:19

0 Answers0