Wednesday, 15 January 2014

javascript - JQuery youtube link to embedded doesnt work -



javascript - JQuery youtube link to embedded doesnt work -

please check: http://jsfiddle.net/t6nja/

my jquery:

$('.training').html(function(i,v){ var id = v.split('watch?v=')[1]; // id can add together iframe homecoming '<iframe width="150" height="150" src="http://www.youtube.com/embed/' + id + '" frameborder="0" allowfullscreen></iframe>'; });

}); html:

<div class="training">http://www.youtube.com/watch?v=dabphlxeyw8e</div><div class="training">http://youtu.be/dabphlxeyw8f</div>

im clueless...

i think problem video id in first div look @ example i've changed video id dabphlxeyw8e dabphlxeyw8

javascript jquery html

No comments:

Post a Comment