如何删除< style>元素与jQuery?
问题描述:
所以有这个网站,我想更改样式的最新变化,因为我认为它丑陋且无用. 我找到了最坏的部分,但奇怪的是我似乎无法将其删除.
so there is this website and i wanna change the latest change in style, because i think it's ugly and useless. i located the bad part, but strangely enough i can't seem to remove it.
<div id="regularMenu">
<ul class='menu2'>
<li>
<a href="/linkA" class="notcurrent">link1</a>
</li>
<li>
<a href="/linkB" class="notcurrent">link2</a>
</li>
<li>
<a href="/linkC" class="notcurrent">link3</a>
</li>
<style>
a, a:visited { color: #832; }
#menu a, #menu a:visited { color: #832; }
.menu2 li a, .menu2 li a:visited { color: #832; }
</style>
</ul>
</div>
我尝试过
$('.menu2> *:last-child').remove();
和
$('/html/body/div[3]/div/ul/style').remove();
那是css路径.我用萤火虫复制了它. 也尝试了复制的Xpath,但:(
that being the css path. i copied it with firebug. also tried it with the copied Xpath but :(
我也尝试过:
$('a').css("color", "#269");
可行,但它也会覆盖旧的CSS规则.而我宁愿保留它.
that works, but it overwrites the old css rule too. and i would rather have that preserved.
我尝试寻找答案,但找不到任何有帮助的方法.所以现在我希望有人可以帮助我解决这个问题.
i tried looking for an answer but i couldn't find any that helped. so now im hoping someone could help me with this.
谢谢!
答
您是否尝试过:
$('.menu2 style').remove();