gpt4 book ai didi

javascript - 如果 URL 包含单词,则在 iframe 中隐藏 div

转载 作者:行者123 更新时间:2023-11-29 18:20:43 25 4
gpt4 key购买 nike

如果主 URL 包含特定单词,我如何在 iframe 中隐藏 div?

@ Hide div if URL contains word描述了如何执行此操作但在 iframe 中不起作用。有办法做到这一点吗?

目前我的代码是这样的:

<script type="text/javascript">
if (window.location.href.indexOf("login") != -1) {
$("#slidewrap").hide();
}
</script>

最佳答案

您需要在 iframe 中引用内容。它们是不同的文件。

$("iframe").contents().find("#slidewrap").hide();

如果用框架的id就更好了

关于javascript - 如果 URL 包含单词,则在 iframe 中隐藏 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19017632/

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