title: Why is replaceChild cause problems?
body: <pre><code>function httpGet(theUrl) {
    var xmlHttp = new XMLHttpRequest();
    xmlHttp.open(&quot;GET&quot;, theUrl, false); // false for synchronous request
    xmlHttp.send(null);
    return xmlHttp.responseText;
  }
  
  var videosT = httpGet(&quot;https://www.googleapis.com/youtube/v3/search?part=snippet&amp;channelId=abcxyz&amp;maxResults=6&amp;order=date&amp;type=video&amp;key=abcxyz&quot;);
  
  const videos = JSON.parse(videosT);
  
  for (let step = 0; step &lt; 6; step++) {
    fetch('js/videos.html')
      .then(res =&gt; res.text())
      .then(text =&gt; {
        let oldelem = document.getElementById(&quot;vid_&quot; + step);
        let newelem = document.createElement(&quot;div&quot;);
        newelem.innerHTML = text;
        oldelem.parentNode.replaceChild(newelem, oldelem);
      })
  }
  </code></pre>
  <p>html:</p>
  <pre><code>    &lt;!doctype html&gt;
  &lt;html lang=&quot;en&quot;&gt;
  
  &lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
    &lt;title&gt;Ashk3000&lt;/title&gt;
    &lt;link href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;
      integrity=&quot;sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx&quot; crossorigin=&quot;anonymous&quot;&gt;
    &lt;link rel=&quot;stylesheet&quot; href=&quot;style.css&quot;&gt;
  
  &lt;/head&gt;
  
  &lt;body class=&quot;d-flex flex-column&quot; viewport-fit=cover&gt;
    &lt;!-- Navbar --&gt;
    &lt;script id=&quot;navbar_placeholder&quot; src=&quot;js/nav.js&quot; page=&quot;home&quot;&gt;&lt;/script&gt;
  
    &lt;!-- Headers --&gt;
    &lt;div
      class=&quot;d-none d-lg-block shadow bg-body border border-5 border-top-0 rounded-bottom w-75 position-relative start-50 translate-middle-x mb-5&quot;&gt;
      &lt;div class=&quot;container-fluid py-5&quot;&gt;
        &lt;h1 class=&quot;display-5 fw-bold&quot;&gt;Home&lt;/h1&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;div class=&quot;d-lg-none shadow-sm bg-body border-bottom border-5 w-100 position-relative mb-3&quot;&gt;
      &lt;div class=&quot;container-fluid py-5&quot;&gt;
        &lt;h1 class=&quot;display-5 fw-bold&quot;&gt;Home&lt;/h1&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;!-- Start --&gt;
  
    &lt;div class=&quot;container&quot;&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div id=&quot;vid_0&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;vid_1&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;vid_2&quot;&gt;&lt;/div&gt;
        &lt;div class=&quot;w-100&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;vid_3&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;vid_4&quot;&gt;&lt;/div&gt;
        &lt;div id=&quot;vid_5&quot;&gt;&lt;/div&gt;
        
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;script src=&quot;js/videos.js&quot;&gt;&lt;/script&gt;
  
    &lt;!-- Footer --&gt;
    &lt;div class=&quot;mt-auto&quot;&gt;&lt;/div&gt;
    &lt;script id=&quot;footer_placeholder&quot; src=&quot;js/footer.js&quot;&gt;&lt;/script&gt;
  
    &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js&quot;
      integrity=&quot;sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa&quot;
      crossorigin=&quot;anonymous&quot;&gt;&lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  <p>videos.html:</p>
  <pre><code>    &lt;div class=&quot;card col&quot; style=&quot;width: 18rem;&quot;&gt;
    &lt;img src=&quot;&quot; id=&quot;thumbnail&quot; class=&quot;card-img-top&quot; alt=&quot;&quot;&gt;
    &lt;div class=&quot;card-body&quot;&gt;
      &lt;h5 id=&quot;title&quot; class=&quot;card-title&quot;&gt;Title&lt;/h5&gt;
      &lt;a href=&quot;#&quot; id=&quot;button&quot; class=&quot;btn btn-primary stretched-link&quot;&gt;Watch&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  <p>Hello, I am getting the replit &quot;Not Found&quot; screen when I try this code. I think it has to do with replaceChild. I am new to java script and dont know what it happening. A lot of it is from the internet. I am trying to make it show recent youtube uploads. It wants me to add more text. sorry this is rushed.</p>