jQuery contents() 方法

jQuery 教程 · 2019-03-27 23:18:07

实例

查找 <div> 元素内所有的文本节点,并把它们用 <b> 元素包裹起来:

$("div").contents().filter("em").wrap("<b/>");

定义和用法

contents() 方法返回所有直接子元素,包括被选元素的文本和注释节点。

文本节点是由元素显示的实际文本。

该方法与 children() 方法类似,不同的是它返回的是文本和注释节点。如果在相同的域中,contents() 方法也能访问 iframe 的 HTML。

语法

$(selector).contents()

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

查看所有标签

Introduction to Tornado

Introduction to Tornado

Michael Dory、Adam Parrish、Brendan Berg / O'Reilly Media / 2012-3-28 / USD 23.99

Tornado is a scalable, non-blocking web server and web application framework written in Python. It is also light-weight to deploy, fun to write for, and incredibly powerful. Tornado was written with p......一起来看看 《Introduction to Tornado》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具