title: Replace instead of append based on user input?
body: <p>This function currently works for appending an img in a div. But I need a replace method instead of multiple img divs stacking on top of each other.</p>
  
  <p>I'm open to solutions in jQuery as well.</p>
  
  <pre><code>function getImg(){
  
      var url=document.getElementById('txt').value;
      var div=document.createElement('div');
      var img=document.createElement('img');
  
      img.className="img-responsive";
  
      img.src=url;
  
      div.appendChild(img);
  
      document.getElementById('gif-btn').innerHTML=""; &lt;!-- Correct answer --&gt;
      document.getElementById('gif-btn').appendChild(div);
  
      return false;
  }
  </code></pre>
  
  <p>Thanks in advance for any and all help. Much appreciated!</p>