Sunday, 15 September 2013

copy title from anchor and show in another div

copy title from anchor and show in another div

I need to make youtube video gallery play videos on the same page when one
click's on the link it should play related video and copy title from the
link and show it as tag under video. .
So far i have do the video part need to how i can copy title from anchor
link to a title div.
I would also appreciate a more professional way on going the whole thing.
CODE on jsFiddle
$(document).ready(function () {
$('.vid_button').click(function (e) {
e.preventDefault();
var URL = $(this).attr('href');
var htm = '<iframe width="438" height="250"
src="http://www.youtube.com/embed/' + URL +
'?wmode=transparent&rel=0&theme=light&color=white&autoplay=0"
frameborder="0" allowfullscreen ></iframe>';
$('#video_container').html(htm);
return false;
});
});

No comments:

Post a Comment