title: Jquery function that toggles div and changes the atrribute source
body: <p>I have edited this question to better explain what I am trying to do.
  I have a page that has a menu div on the side of a page, in this div the menu items are dynamically created from a database, this allows me to show a video as a thumbnail image by disabling the video controls. So the src attribute is dynamically created and generated in the menu video. When a click event is actioned on the video menu button the source from the button needs to be passed to the video player source attribute so the chosen video plays in the video player.
  Initially I looked at toggling the div using the button then using an onload or load event to do this exchange of source code, but I don't think that was the way to go, so this is the code I have that creates the video button dynamically</p>
  
  <p><strong>Video button</strong></p>
  
  <pre><code>&lt;video id="&lt;?php echo $vidID ?&gt;" class="vidContainer"&gt;
  &lt;source id="vidLink" class="vidLink" src="&lt;?php echo $vidUrl ?&gt;"  type="video/ogg"&gt;
   Your browser does not support the HTML5 tags.
  
  &lt;/video&gt;
  </code></pre>
  
  <p>I tried the addition of the following to get the src from the button to pass into the video player div</p>
  
  <p><strong>Modified code</strong></p>
  
  <pre><code>&lt;video id="&lt;?php echo $vidID ?&gt;" class="vidContainer" onClick="document.getElementById('vidiframeweap').getElementsByTagname('source')[0].getAttribute('src')"&gt;
  &lt;source id="vidLink" class="vidLink" src="&lt;?php echo $vidUrl ?&gt;"  type="video/ogg"&gt;
   Your browser does not support the HTML5 tags.
  
  &lt;/video&gt;
  
  &lt;div class="vidText"&gt;&lt;?php echo $vidName ?&gt;&lt;/div&gt;
  </code></pre>
  
  <p>This is the video player div with the video tags within which is where I'd like to put the src code from the button</p>
  
  <p><strong>Video div code</strong></p>
  
  <pre><code>  &lt;div id="vidiframeweap" class="vidiframeweap"&gt;
  
      &lt;video id="player" class="player" preload="auto" controls&gt;
      &lt;source id="playermp4" src="" type="video/mp4"&gt;
          &lt;source id="playerogg" src="" type="video/ogg"&gt;
      &lt;/video&gt;  
  
    &lt;/div&gt;
  </code></pre>
  
  <p>I hope I have provided a better explanation of what im trying to achieve and if anyone can help me to figure out the best way to do this I would be most greatful</p>