<style> /*高亮显示*/ .highlight{ background-color: gray } </style>
<div> <p>Hello</p> </div> <div>ID为test的DIV</div> <input>足球 <input>排球 <input>篮球 <input>其他
[attribute] Usage
Definition: Match elements that contain the given attribute
$("div[id]").addClass("highlight"); //查找所有含有ID属性的div元素
2. [attribute=value] Usage
Definition: Match elements where the given attribute is a specific value
$("input[name='basketball']").attr("checked",true); //name属性值为basketball的input元素选中
3. [attribute! =value] Usage
Definition: Match the given attribute is an element that does not contain a specific value
$("input[name!='basketball']").attr("checked",true); //name属性值不为basketball的input元素选中 //此选择器等价于:not([attr=value])要匹配含有特定属性但不等于特定值的元素,请使用[attr]:not([attr=value]) $("input:not(input[name='basketball'])").attr("checked",true);
4. [attribute^=value] Usage
Definition: Match the given attribute is an element that starts with a certain value
$("input[name^='foot']").attr("checked",true); //查找所有 name 以 'foot' 开始的 input 元素
5. [attribute$=value] Usage
Definition: Match the given attribute that ends with some value
$("input[name$='ball']").attr("checked",true); //查找所有 name 以 'ball' 结尾的 input 元素
6. [attribute*=value] Usage
Definition: Match the given attribute that ends with a certain value Elements of certain values
$("input[name*='sket']").attr("checked",true); //查找所有 name 包含 'sket' 的 input 元素
7. [selector1][selector2][selectorN] Usage
Definition: Composite attribute selector, used when multiple conditions need to be met at the same time
$("input[id][name$='ball']").attr("checked",true); //找到所有含有 id属性,并且它的 name属性是以 ball结尾的
More jquery selectors For detailed explanation of the attribute filter selector, please pay attention to the PHP Chinese website for related articles!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Notepad++7.3.1
Easy-to-use and free code editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 English version
Recommended: Win version, supports code prompts!
