jQuery wrapInner() 方法

jQuery 教程 · 2019-03-27 21:16:53

实例

在每个 <p> 元素的内容上包裹 <b> 元素:

$("button").click(function(){ $("p").wrapInner("<b></b>"); });

定义和用法

wrapInner() 方法使用指定的 HTML 元素来包裹每个被选元素中的所有内容(innerHTML)。

语法

$(selector).wrapInner(wrappingElement,function(index))

参数 描述
wrappingElement 必需。规定包围在每个被选元素的内容周围的 HTML 元素。

可能的值:

  • HTML 元素
  • jQuery 对象
  • DOM 元素
function(index) 可选。规定返回包裹元素的函数。
  • index - 返回集合中元素的 index 位置。

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

查看所有标签

Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications

Kenneth H Rosen / McGraw-Hill Science/Engineering/Math / 2003-04-22 / USD 132.81

Discrete Mathematics and its Applications is a focused introduction to the primary themes in a discrete mathematics course, as introduced through extensive applications, expansive discussion, and deta......一起来看看 《Discrete Mathematics and Its Applications》 这本书的介绍吧!

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

RGB HEX 互转工具

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

Markdown 在线编辑器