Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/89.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/visual-studio/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Javascript根据内容选择和隐藏元素?_Javascript_Html - Fatal编程技术网

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

使用Javascript根据内容选择和隐藏元素?,javascript,html,Javascript,Html,我现在正在为一个项目使用机车车辆。有一个管理按钮,它是为登录用户生成和显示的,但我不希望它出现在那里。不幸的是,开发人员没有将任何类或ID与按钮关联,所有HTML都是内联的,所以我无法隐藏它。我想知道是否可以使用javascript来定位和隐藏这个元素。以下是生成的HTML: <a href="/products/_admin" onmouseout="this.style.backgroundPosition='0px 0px'" onmouseover="this.style.back

我现在正在为一个项目使用机车车辆。有一个管理按钮,它是为登录用户生成和显示的,但我不希望它出现在那里。不幸的是,开发人员没有将任何类或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()

也许是你想要的我不是在鼓吹,我只是把它扔出去。总是有
!重要信息
@kei-我认为问题更多的是如何覆盖内联样式,而不是能够针对链接。