jQuery insertAfter() 方法

jQuery 教程 · 2019-03-27 14:41:58

实例

在每个 <p> 元素后插入一个 <span> 元素:

$("button").click(function(){ $("<span>Hello world!</span>").insertAfter("p"); });

定义和用法

insertAfter() 方法在被选元素后插入 HTML 元素。

提示:如需在被选元素前插入 HTML 元素,请使用 insertBefore() 方法。

语法

$(content).insertAfter(selector)

参数 描述
content 必需。规定要插入的内容(必须包含 HTML 标签)。

注意:如果 content 是已存在的元素,它将从它的当前位置被移除,并被插入在被选元素之后。
selector 必需。规定在何处插入内容。

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

查看所有标签

Rationality for Mortals

Rationality for Mortals

Gerd Gigerenzer / Oxford University Press, USA / 2008-05-02 / USD 65.00

Gerd Gigerenzer's influential work examines the rationality of individuals not from the perspective of logic or probability, but from the point of view of adaptation to the real world of human behavio......一起来看看 《Rationality for Mortals》 这本书的介绍吧!

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

在线压缩/解压 HTML 代码

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

URL 编码/解码
URL 编码/解码

URL 编码/解码