开发者

Adding youtube videos to a web app

开发者 https://www.devze.com 2023-02-12 05:31 出处:网络
I am developing a widget which ac开发者_JAVA百科tually allows user to add youtube videos, different users should be able to add different videos. For Example if user A can add say \"x\" video, he just

I am developing a widget which ac开发者_JAVA百科tually allows user to add youtube videos, different users should be able to add different videos. For Example if user A can add say "x" video, he just need to copy and paste it and user B can add say "y" video. I am providing a textbox to paste the you tube video link. I am using jquery at the front end.


You can use jQuery to create a iframe and set the source to the youtube video url.

like this:

 $("#somebutton").click(function(){
    var srcurl = $("#textbox").val();
    $("#mydiv").html("<iframe title=\"YouTube video player\" width=\"640\" height=\"390\" src=\"" + srcurl + "frameborder=\"0\" allowfullscreen></iframe>");
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号