[英]css selector or xpath selector
I have a div in the code. 我在代码中有一个div。 I dont want to display it or delete it.
我不想显示或删除它。 Either is ok
都可以
the following is the code: 以下是代码:
<div addthis:url="http://sampletest.com/?p=2748" class="addthis_toolbox addthis_default_style " addthis:title="Clarifying the event "></div>
this is from wordpress page. 这是从WordPress页面。
I dont know in css how to select addthis:url="http://sampletest.com/?p=2748" and addthis:title="Clarifying the event " because class="addthis_toolbox addthis_default_style is not unique thing to slect 我不知道在CSS中如何选择addthis:url =“ http://sampletest.com/?p=2748”和addthis:title =“澄清事件”,因为class =“ addthis_toolbox addthis_default_style不是唯一的选择
I tried using javascript 我尝试使用javascript
element = document.evaluate('//div[@addthis:url="http://sampletest.com/?p=2748"]',
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null);
but it selects none. 但没有选择。
It has a class. 它有一个类。 All you have to do is target that class in your CSS.
您所需要做的就是在CSS中定位该类。
The class is addthis_toolbox
, so the following will hide the div
and its contents. 该类是
addthis_toolbox
,因此以下内容将隐藏div
及其内容。
.addthis_toolbox {
display: none;
}
Just make sure this class isn't used in other elements that you don't wish to hide, otherwise they'll be hidden as well. 只要确保不要在您不想隐藏的其他元素中使用此类,否则它们也将被隐藏。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.