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://www.codercto.com/courses/l/35.html

查看所有标签

The Algorithmic Beauty of Plants

The Algorithmic Beauty of Plants

Przemyslaw Prusinkiewicz、Aristid Lindenmayer / Springer / 1996-4-18 / USD 99.00

Now available in an affordable softcover edition, this classic in Springer's acclaimed Virtual Laboratory series is the first comprehensive account of the computer simulation of plant development. 150......一起来看看 《The Algorithmic Beauty of Plants》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

正则表达式在线测试
正则表达式在线测试

正则表达式在线测试