title: How to add autoplay attribute in html5 video player
body: <p>I want to add an attribute <code>autoplay</code> to a <code>&lt;video&gt;&lt;/video&gt;</code> element, when a specific target button is clicked. </p>
  
  <p>HTML </p>
  
  <pre><code>&lt;video controls&gt;
    &lt;source src="video.mp4" type="video/mp4"&gt;
  &lt;/video&gt;
  </code></pre>
  
  <p>I tried with jQuery:</p>
  
  <pre><code>$('.targetButton').on('click', function(){
    $('video').attr("autoplay"," ");
  });
  </code></pre>
  
  <p>... but the video does not play. What am I doing wrong?</p>