我有一个这样的脚本,它运行良好!
<div id="player"></div>
jQuery文件:
$(document).ready(function(){
//You can alternatively pass an object:
$('#player').youTubeEmbed({
video : 'http://www.youtube.com/watch?v=uyeJXKfAcpc',
width : 640, // Height is calculated automatically
progressBar : true // Hide the progress bar
});
});
但现在我想在这样的输入值中制作 youtube id:
<div id="player">
<input type="hidden" name="youtube-id" value="uyeJXKfAcpc" />
</div>
并将其传递给 jquery 是这样的:
$(document).ready(function(){
//You can alternatively pass an object:
$('#player').youTubeEmbed({
var yid = $(this).children("input[name='youtube-id']"),
video : 'http://www.youtube.com/watch?v=' . yid,
width : 640, // Height is calculated automatically
progressBar : true // Hide the progress bar
});
});