title: JS Delete div content and write new code
body: <p>I have this code </p>
  
  <pre><code> &lt;div class="carousel-inner" role="listbox"&gt;
  
       &lt;div class="item"&gt;
          &lt;img src="http://" alt=""&gt;
          &lt;div class="carousel-caption text-left"&gt;
            &lt;div class="container"&gt;
  
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="item"&gt;
          &lt;img src="http://" alt=""&gt;
          &lt;div class="carousel-caption text-left"&gt;
            &lt;div class="container"&gt;
  
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>I want to replace only in the first div, <code>&lt;img src = "" alt = ""&gt;</code> with <code>&lt;video&gt; &lt;source src = ""&gt; &lt;/ video&gt;</code>.</p>
  
  <p>To clean up div I found this code. But not the first. This is the first problem.</p>
  
  <pre><code>$('.item").empty();
  </code></pre>
  
  <p>To write the new code to play the video, I should use this code:</p>
  
  <pre><code>$(".item").html('&lt;video&gt;&lt;source src=""&gt;&lt;/video&gt;');
  </code></pre>
  
  <p>I can not write a good javascript code to do what I explained you.
  ps. I can’t change the first code because it’s a default slider of image.
  Thanks for the help.</p>