0
我希望能够从嵌入式vimeo视频访问类。我的iframe如下:嵌入式文档的访问元素
HTML
<iframe id="vimeo" src="//player.vimeo.com/video/85509673?portrait=0&badge=0&color=a82a2a" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
我想要一个click事件添加到play-button-cell
类,像这样:
jQuery的
var embeddedContent = $("#vimeo");
console.log(embeddedContent);
var doc = embeddedContent.contentDocument; // get the inner DOM
console.log(doc);
console.log(doc.jQuery(".play-button-cell"));
doc.jQuery(".play-button-cell").click(function(){
alert('ok!');
});
,我得到以下控制台中的错误消息:
Uncaught TypeError: Cannot call method 'jQuery' of undefined
play-button-cell
确实存在,因为我可以在播放按钮上“检查元素”时看到它。 如何访问嵌入式内容中的类?这可能吗?