search
HomeWeb Front-endHTML TutorialHow to select elements whose attributes are not equal to a certain value or do not have the attribute_html/css_WEB-ITnose

For example

<div>  <vbox name="xxx" />  <vbox />  <vbox /></div>


How to select two vboxes without name attribute


Reply to discussion (solution)

Although it can be taken out in this way, the lower version of IE does not seem to support this kind of tag. Use with caution.

<div id="div">    <vbox name="xxx" ></vbox>    <vbox></vbox>    <vbox></vbox></div><script type="text/javascript">    var div = document.getElementById('div');    var box = div.getElementsByTagName('vbox');    var arr = [];    for(var i = 0; i < box.length; i++){        if(!box[i].getAttribute('name')){            arr.push(box[i]);        }    }    console.log(arr);</script>

Use xpath

//vbox[not(@name)]

Use jQuery
$('vbox:not([name])')

$('vbox:not([name])')

It is recommended that you use the universal jquery

$('vbox:not([name])')

It is recommended that you use the universal jquery



1.

Use xpath

//vbox[not(@name)]

Use jQuery
$('vbox:not([name])')



Sorry, add
to use CSS selector


use xpath

//vbox[not(@name)]

Use jQuery
$('vbox:not([name])')



Sorry, add
You need to use CSS selector

Try it
vbox:not([@name])

The following jQuery is a CSS selector. If you use jQuery, you should be able to take out the elements you need. I have tested it before replying yesterday. You can click to view the demo code
If you use other js frameworks, you can tell me.


Use xpath

//vbox[not(@name)]

Use jQuery
$('vbox:not([name])')



Sorry, add
to use CSS selector

not

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
在JavaFX中,有哪些不同的路径元素?在JavaFX中,有哪些不同的路径元素?Aug 28, 2023 pm 12:53 PM

javafx.scene.shape包提供了一些类,您可以使用它们绘制各种2D形状,但这些只是原始形状,如直线、圆形、多边形和椭圆形等等...因此,如果您想绘制复杂的自定义形状,您需要使用Path类。Path类Path类使用此表示形状的几何轮廓您可以绘制自定义路径。为了绘制自定义路径,JavaFX提供了各种路径元素,所有这些都可以作为javafx.scene.shape包中的类使用。LineTo-该类表示路径元素line。它可以帮助您从当前坐标到指定(新)坐标绘制一条直线。HlineTo-这是表

C++程序:向数组中添加一个元素C++程序:向数组中添加一个元素Aug 25, 2023 pm 10:29 PM

数组是一种线性顺序数据结构,用于在连续的内存位置中保存同质数据。与其他数据结构一样,数组也必须具备以某种有效方式插入、删除、遍历和更新元素的功能。在C++中,我们的数组是静态的。C++中还提供了一些动态数组结构。对于静态数组,该数组内可能存储Z个元素。到目前为止,我们已经有n个元素了。在本文中,我们将了解如何在C++中在数组末尾插入元素(也称为追加元素)。通过示例理解概念‘this’关键字的使用方式如下GivenarrayA=[10,14,65,85,96,12,35,74,69]Afterin

html5不支持哪些元素html5不支持哪些元素Aug 11, 2023 pm 01:25 PM

html5不支持的元素有纯表现性元素、基于框架的元素、应用程序元素、可替换元素和旧的表单元素。详细介绍:1、纯表现性的元素,如font、center、s、u等,这些元素通常被用于控制文本样式和布局;2、基于框架的元素,如frame、frameset和noframes,这些元素在过去用于创建网页布局和分割窗口;3、应用程序相关的元素,如applet和isinde等等。

jquery怎么移除 元素jquery怎么移除 元素Feb 17, 2023 am 09:49 AM

jquery移除元素的方法:1、通过jQuery remove()方法删除被选元素及其子元素,语法是“$("#div1").remove();”;2、通过jQuery empty()方法删除被选元素的子元素,语法是“$("#div1").empty();”。

如何使用HTML和CSS实现一个具有固定导航菜单的布局如何使用HTML和CSS实现一个具有固定导航菜单的布局Oct 26, 2023 am 11:02 AM

如何使用HTML和CSS实现一个具有固定导航菜单的布局在现代网页设计中,固定导航菜单是常见的布局之一。它可以使导航菜单始终保持在页面顶部或侧边,使用户可以方便地浏览网页内容。本文将介绍如何使用HTML和CSS实现一个具有固定导航菜单的布局,并提供具体的代码示例。首先,需要创建一个HTML结构来呈现网页的内容和导航菜单。以下是一个简单的示例

如何在Java中删除ArrayList的所有元素?如何在Java中删除ArrayList的所有元素?Sep 20, 2023 pm 02:21 PM

List接口扩展了Collection接口并存储元素序列。List接口提供了两种方法来有效地在列表中的任意点插入和删除多个元素。与集合不同,列表允许重复元素,如果列表中允许空值,则允许多个空值。List提供了add、remove方法来添加/删除元素。为了清除列表或从列表中删除所有元素,我们可以使用List的clear()方法。我们也可以使用removeAll()方法来达到与clear()方法相同的效果。在本文中,我们将通过相应的示例介绍clear()和removeAll()方法。语法-clear

Python程序:替换列表中的元素Python程序:替换列表中的元素Aug 25, 2023 pm 06:48 PM

在Python中,可以使用列表将多个项目保存在单个变量中。Python中用于存储数据集合的四种内置数据类型之一是列表,其他三种是元组、集合和字典,每种类型都有独特的用途。什么是列表?方括号用于构建列表。Python中最有效的工具是列表,因为它们不一定是同类的。像整数、字符串和对象这样的数据类型都可以在一个列表中找到。由于列表是可变的,因此即使在创建列表之后也可以对其进行更改。Python列表包含重复值的能力是其主要功能之一。这允许我们循环遍历列表的项目并确定每个项目的值。如果该值必须被替换,我们

Java程序:在循环链表中搜索元素Java程序:在循环链表中搜索元素Sep 11, 2023 am 11:45 AM

什么是喜欢列表和循环链表?链表是一种数据结构,其中每个节点都包含两部分,数据和地址路径。这些部分指向下一个节点,该节点始终与先前的节点创建互连。基于此,循环链表是最后一个节点与第一个节点有内部链接,这就是这种类型的链表称为循环链表。在Java环境中,当我们查找元素循环链表时,需要在链表中创建一个临时节点来指向。这样我们还需要声明两个变量。它们是曲目索引和曲目搜索。如果Temp节点在起始点为空,那么遍历列表就很重要,因为此时它不包含任何项目。循环链表的工作原理及其应用?循环链表的工作方法对于循环链

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment