HTML 代码
<ins class="adsbygoogle" style="display:inline-block;width:336px;height:280px" data-ad-client="ca-pub-1714167228247329" data-ad-slot="8611448539" data-adsbygoogle-status="done" data-ad-status="unfilled">
我已经查看了:https://www.w3schools.com/js/js_htmldom_elements.asp,并尝试过了,但没有帮助。
我想使用Javascript从HTML中获取这个元素data-ad-status="unfilled"
。这样,我可以在if else语句中使用它。
例如:
if (data-ad-status="unfilled") {
some fuctions;
}
document.querySelector();
。https://developer.mozilla.org/zh-CN/docs/Web/API/Document/querySelector - Laaouatni AnasElement.querySelector()
可以限制搜索到 DOM 子树,可能允许更简洁的选择器并提高性能。 - collapsarif ($(".adsbygoogle").data("ad-status") === "unfilled") { ...
- freedomn-m