我有這樣的腳本,它運行良好!將HTML的值傳遞給jQuery文件
<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
});
});
你能更具體與您的問題嗎? – SomeKittens 2012-08-05 04:30:56
我只需要存儲隱藏輸入的值,並將其傳遞給上述javascript文件中的varible,並在'http://www.youtube.com/watch?v='作爲變量 – user1576910 2012-08-05 04:38:57