title: Show uploaded picture instead of upload button
body: <p>I have a "button" (an anchor that acts like a button). Where you can upload a picture that gets previewed. </p>
  
  <p>But what I want to do is to make the uploaded picture to be displayed instead of the button (same size etc). Is there a nice way of doing this?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
  
      function readURL(input) {
  
          if (input.files &amp;&amp; input.files[0]) {
              var reader = new FileReader();
  
              reader.onload = function (event) {
                  $('#imageChosen').attr('src', event.target.result);
              }
  
              reader.readAsDataURL(input.files[0]);
          }
      }
  
      $('#fileInput').change(function(){
          readURL(this);
      });
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>div.input {
      border-style: solid;
      border-width: 5px;
   display: inline-block;
  }
  
  #filebutton {
   width: 100px;
   height: 100px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
   &lt;title&gt;for testing&lt;/title&gt;
  
   &lt;script src="js/jquery-3.2.1.min.js"&gt;&lt;/script&gt;
   &lt;script src="js/costum.js"&gt;&lt;/script&gt;
   &lt;link rel="stylesheet" type="text/css" href="css/costum.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
   &lt;div class="input"&gt;
    &lt;label for="fileInput"&gt;
     &lt;input type="file" id="fileInput" style="display: none;" /&gt;
     &lt;a style="display: block;" type="button" id="filebutton"&gt;Upload&lt;/a&gt;
     &lt;img id="imageChosen"&gt;
    &lt;/label&gt; 
   &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>