jQuery :has() 选择器

jQuery 教程 · 2019-03-10 13:11:51

实例

选取所有包含有 <span> 元素在其内的 <p> 元素:

$("p:has(span)")

定义和用法

:has() 选择器选取所有包含一个或多个元素在其内的元素,匹配指定的选择器。

提示:为了选取包含有多个元素在其内的元素,请使用逗号(参见下面的实例)。

语法

$(":has(selector)")

参数 描述
selector 必需。规定要选取的元素。
该参数接受任何类型的选择器。

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

查看所有标签

Designing with Web Standards (2nd Edition)

Designing with Web Standards (2nd Edition)

Jeffrey Zeldman / Peachpit Press / 2006-07-06 / USD 44.99

Best-selling author, designer, and web standards evangelist Jeffrey Zeldman has updated his classic, industry-shaking guidebook. This new edition--now in full color--covers improvements in best prac......一起来看看 《Designing with Web Standards (2nd Edition)》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

MD5 加密
MD5 加密

MD5 加密工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器