按钮代码如下
<div class="click-area"></div>
<div class="option-item first-option">A</div>
要求是当按钮出现时实现自动点击,谢谢啦
<div class="click-area"></div>
<div class="option-item first-option">A</div>
要求是当按钮出现时实现自动点击,谢谢啦
1
no1xsyzy Aug 7, 2020 当按钮出现时?
那只有 MutationObserver 了 |
5
no1xsyzy Aug 7, 2020
|
6
ochatokori Aug 7, 2020 via Android
类选择器
|
7
kuro1 Aug 7, 2020
$("body").bind('DOMNodeInserted', function(e)
|
8
wlor Aug 7, 2020
$("body").bind('DOMNodeInserted', (e) =>{
if ($(e.target).attr("class") === "option-item first-option") { $(e.target).click() $('body').unbind("DOMNodeInserted"); } }); |
9
no1xsyzy Aug 7, 2020 |
10
wlor Aug 7, 2020
好的 学习了
|
11
pluszone Aug 7, 2020
document.querySelector('#xxxxxxx').click();
可以用 setTimeout 写个延时 |
12
yulihao OP #11 楼
正解 |