Changing Video src using jquery -



Changing Video src using jquery -

this question has reply here:

changing source on html5 video tag 13 answers

i want alter video scr when play button click html is

<video class="mvideo" controls autoplay="autoplay"> <source class="video" src="path.mp4" type="video/mp4" /> </video> <button class="button">play</button>

and jquery is

$(document).ready(function(){ $(".button").click(function(){ $(".video").attr("src","videos/funny cats.mp4"); }) });

the way dynamic sources going work if apply them straight video tag eg:

<video class="mvideo" controls autoplay="autoplay"></video> <button class="button">play</button> $(document).ready(function(){ $(".button").click(function(){ $("video").attr("src","videos/funny cats.mp4"); }); });

http://jsfiddle.net/xemzm/2/

source

jquery

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -