jQuery [attribute|=value] 选择器

jQuery 教程 · 2019-03-10 15:57:19

实例

选取所有带有以 "Tomorrow" 开头的 title 属性的 <p> 元素:

$("p[title|='Tomorrow']")

定义和用法

[attribute|=value] 选择器选取每个带有指定属性的元素,该元素的值等于指定字符串(比如 "en")或以该字符串后跟连接符作为开头的字符串(比如 "en-us")。

提示:该选择器经常用于处理 language 属性。

语法

$("[attribute|='value']")

参数 描述
attribute 必需。规定要查找的属性。
value 必需。规定属性值需以此开头的字符串。

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

Web Anatomy

Web Anatomy

Robert Hoekman Jr.、Jared Spool / New Riders / 2009-12-11 / USD 39.99

At the start of every web design project, the ongoing struggles reappear. We want to design highly usable and self-evident applications, but we also want to devise innovative, compelling, and exciting......一起来看看 《Web Anatomy》 这本书的介绍吧!

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

随机密码生成器
随机密码生成器

多种字符组合密码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具