JQuery的YouTube的链接到嵌入式不工作 [英] JQuery youtube link to embedded doesnt work

查看:121
本文介绍了JQuery的YouTube的链接到嵌入式不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请检查: http://jsfiddle.net/T6Nja/

My JQuery:

My JQuery:

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

});
我的HTML:

}); My HTML:

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

Im clueless ...

Im clueless...

推荐答案

我认为问题是第一个div中的视频ID 看这个例子我已将视频ID从 DABphlXEyW8e 更改为 DABphlXEyW8

I think the problem is the video id in the first div look at this example where i've changed the video id from DABphlXEyW8e to DABphlXEyW8

这篇关于JQuery的YouTube的链接到嵌入式不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆