このようなスクリプトがあり、うまく動作します!
<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
});
});