隐藏没有类别/编号的DIV [英] Hide a DIV which has no class/id

查看:177
本文介绍了隐藏没有类别/编号的DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过CSS或JavaScript隐藏没有类/ID的div?该页面中可能还有另一个div.

Is it possible to hide a div with no class/id via css, or javascript? There is a possibility another div like this to be in the page.

<div align="center">text here</div>

实际上,这是一个ebay列表模板,将要使用的软件将div底部添加了javascript和flash gallery,这就是为什么我要隐藏该东西的原因.

Actually, it is an ebay listing template, and the software that will be used adds this div at the bottom with javascript and flash gallery in it and I that is why I want to hide that thing.

div在2条评论之间:

The div is between 2 comments:

<!--GalleryShowcaseFlash-->
<div align="center">text here</div>
<!--EndOfGalleryShowcaseFlash-->

这些注释是否可以帮助使用javascript删除它们之间的div?

Can these comments help to be removed the div between them with javascript?

推荐答案

我们在这里没有什么可以具体说明的,您实际上应该添加一个类或ID.没有它,它必须是这样的:

There's not much we can go off here to be specific, you should really add a class or ID. Without that, it'd have to be something like:

div[align="center"] {
    display: none;
}

对于该文本选择器,在CSS中是不可能的

如果是jQuery,我们可以更具体一些,然后做

If it was jQuery, we could be a bit more specific and do

$("div[align='center']:contains('text here')").hide();

这篇关于隐藏没有类别/编号的DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆