title: play youtube video on click custom button
body: <p>I do have following code where i want to play youtube video when button is clicked.</p>
  
  <p>I have iframe code for youtube.</p>
  
  <pre><code>&lt;script&gt;
  
              var player = document.getElementById("myplayer");
  
              //Create a simple function and check if player exists
              function play() {
                  if(player) {
                      player.playVideo();
                  }
              }
  
  
   &lt;/script&gt;
  
  
  &lt;iframe id="myplayer" width="500" height="500" src="http://www.youtube-nocookie.com/embed/C-VoyCDUvr0?rel=0&amp;wmode=Opaque&amp;enablejsapi=1" frameborder="0" allowfullscreen&gt;&lt;/iframe&gt;
  
  &lt;a href="#" onclick="play()"&gt;Play Youtube Video&lt;/a&gt;
  </code></pre>
  
  <p>But it does not play when i click on button / link</p>
  
  <p>I put script code in head part of html and iframe and anchor link in body part of html.</p>
  
  <p><img src="https://i.stack.imgur.com/RNYW7.jpg" alt="enter image description here"></p>
  
  <p>Am i missing anything?</p>