gpt4 book ai didi

javascript - 使用 Javascript 根据内容选择和隐藏元素?

转载 作者:行者123 更新时间:2023-12-02 17:53:40 28 4
gpt4 key购买 nike

我现在正在一个项目中使用 LocomotiveCMS。有一个为登录用户生成并显示的管理按钮,但我不希望它在那里。不幸的是,开发人员没有将任何类或 ID 与按钮关联起来,并且所有 HTML 都是内联的,所以我无法隐藏它。我想知道是否可以使用 javascript 定位并隐藏此元素。下面是生成的 HTML:

<a href="/products/_admin" onmouseout="this.style.backgroundPosition='0px 0px'" onmouseover="this.style.backgroundPosition='0px -45px'" onmousedown="this.style.backgroundPosition='0px -90px'" onmouseup="this.style.backgroundPosition='0px 0px'" style="display: block; z-index: 1031; position: fixed; top: 10px; right: 10px; width: 48px; height: 45px; text-indent: -9999px; text-decoration: none; background-image: url(http://localhost:8080/assets/locomotive/icons/start.png); background-color: transparent; background-position: 0px 0px; background-repeat: no-repeat no-repeat;">Admin</a>

谢谢!

最佳答案

使用 jQuery,

$("a[href='/products/_admin']").hide()

关于javascript - 使用 Javascript 根据内容选择和隐藏元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21145198/

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