如何改变youtube动态地嵌入vidoe通过jery [英] how change youtube embed vidoe Dynamically Through jery
本文介绍了如何改变youtube动态地嵌入vidoe通过jery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个youtube嵌入,我不会点击更改歌曲
i需要刷新页面?
这是代码:
html:
< iframe id ='youtubePlayer'width = 250 height = 200 src ='http: //www.youtube.com/embed/faslvcx3?modestbranding=1'frameborder ='0'>< / iframe>;
这是juery代码:
function myfunction(code_play)
{
$('youtubePlayer')。attr(src,http://www.youtube.com/embed/+ code_play +?modestbranding = 1);
}
解决方案
('youtubePlayer')。attr(src,http://www.youtube.com/embed/+ code_play +?modestbranding = 1);
}
您正在使用iframe ..因为普通选择器不起作用..
尝试使用
function myfunction(code_play)
{
( body)。find(' #youtubePlayer')。attr( src, http://www.youtube.com/embed/ + code_play + ?modestbranding = 1);
}
并且在您的代码中选择器使用的方式错误
i have a youtube embed and i wont in click to change the song
i need refresh the page?
this is the code:
html:
<iframe id='youtubePlayer' width=250 height=200 src='http://www.youtube.com/embed/faslvcx3?modestbranding=1' frameborder='0'></iframe>";
this is the juery code :
function myfunction(code_play) { $('youtubePlayer').attr("src","http://www.youtube.com/embed/"+ code_play + "?modestbranding=1"); }
解决方案
('youtubePlayer').attr("src","http://www.youtube.com/embed/"+ code_play + "?modestbranding=1"); }
You are using iframe..So normal selector will not work..
Try using
function myfunction(code_play) {
("body").find('#youtubePlayer').attr("src","http://www.youtube.com/embed/"+ code_play + "?modestbranding=1"); }
And also in your code the selector used in wrong way
这篇关于如何改变youtube动态地嵌入vidoe通过jery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文