Trying to turn youtube links to embeded, but my jquery doesnt seem to grab the video ids from the links
My JQuery:
$('.a').html(function(i, html) {
return html.replace(/(?:http:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?v=)?(.+)/g,'<iframe width="150" height="150" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>');
});
My HTML:
<div class="a">http://www.youtube.com/watch?v=w_yudtBvhCsc</div>
<div class="a">http://www.youtube.com/watch?v=w_yudtBvhCsd</div>
Im clueless...