javascript - Jquery function that toggles div and changes the atrribute source -


i have edited question better explain trying do. have page has menu div on side of page, in div menu items dynamically created database, allows me show video thumbnail image disabling video controls. src attribute dynamically created , generated in menu video. when click event actioned on video menu button source button needs passed video player source attribute chosen video plays in video player. looked @ toggling div using button using onload or load event exchange of source code, don't think way go, code have creates video button dynamically

video button

<video id="<?php echo $vidid ?>" class="vidcontainer"> <source id="vidlink" class="vidlink" src="<?php echo $vidurl ?>"  type="video/ogg">  browser not support html5 tags.  </video> 

i tried addition of following src button pass video player div

modified code

<video id="<?php echo $vidid ?>" class="vidcontainer" onclick="document.getelementbyid('vidiframeweap').getelementsbytagname('source')[0].getattribute('src')"> <source id="vidlink" class="vidlink" src="<?php echo $vidurl ?>"  type="video/ogg">  browser not support html5 tags.  </video>  <div class="vidtext"><?php echo $vidname ?></div> 

this video player div video tags within i'd put src code button

video div code

  <div id="vidiframeweap" class="vidiframeweap">      <video id="player" class="player" preload="auto" controls>     <source id="playermp4" src="" type="video/mp4">         <source id="playerogg" src="" type="video/ogg">     </video>      </div> 

i hope have provided better explanation of im trying achieve , if can me figure out best way greatful

the id of element used wrong think, playermp4 use this:

$('#playermp4').attr('src','http://www.dot-mov.com/uploadedvideo/testing3/editbike3.ogv'); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -