gpt4 book ai didi

jquery - 无法使用 jQuery play() 播放视频

转载 作者:行者123 更新时间:2023-12-01 04:06:20 25 4
gpt4 key购买 nike

我希望 jQuery 在按下按钮时播放我的 iframe 视频

JS:

$(document).ready(function() {
$('#play').click(function() { //#play is the id of the button
$('#video').get(0).play(); //video id
});
});

我尝试用

替换视频 ID

$('iframe')

没有效果。

最佳答案

如果视频元素位于 iframe 中

$('iframe').contents().find('#video').get(0).play();

关于jquery - 无法使用 jQuery play() 播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27560538/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com