Passing Value Of HTML To JQuery File
I have a script like this, and it runs well! the jQuery file: $(document).ready(function(){ //You can alternatively pass an object: $(
Solution 1:
You are declaring a variable inside an object, move it to above the youTubeEmbed
plugin, also use the .val()
method to access the input's value.
var yid = $("input[name='youtube-id']").val();
$('#player').youTubeEmbed({
video : 'http://www.youtube.com/watch?v=' + yid,
width : 640, // Height is calculated automatically
progressBar : true // Hide the progress bar
});
Solution 2:
There is no need to use an input at all. do -
<div id="player" data-youtube="uyeJXKfAcpc"></div>
Your jQuery -
$('#player').youTubeEmbed({
video: 'http://www.youtube.com/watch?v=' + $(this).attr('data-youtube'),
width: 640,
progressBar: true
});
Post a Comment for "Passing Value Of HTML To JQuery File"