Juery手册 专题
专题目录
您的位置:JS框架 > Juery手册专题 > Jquery1.7-after(content|fn)
Jquery1.7-after(content|fn)
作者:--    发布时间:2019-11-21

返回值:jqueryafter(content|fn)

概述

在每个匹配的元素之后插入内容。

参数

contentstring, element, jqueryv1.0

插入到每个目标后的内容

functionfunctionv1.4

函数必须返回一个html字符串。

示例

描述:

在所有段落之后插入一些html标记代码。

html 代码:
<p>i would like to say: </p>
jquery 代码:
$("p").after("<b>hello</b>");
结果:
<p>i would like to say: </p><b>hello</b>

描述:

在所有段落之后插入一个dom元素。

html 代码:
<b id="foo">hello</b><p>i would like to say: </p>
jquery 代码:
$("p").after( $("#foo")[0] );
结果:
<p>i would like to say: </p><b id="foo">hello</b>

描述:

在所有段落中后插入一个jquery对象(类似于一个dom元素数组)。

html 代码:
<b>hello</b><p>i would like to say: </p>
jquery 代码:
$("p").after( $("b") );
结果:
<p>i would like to say: </p><b>hello</b>
网站声明:
本站部分内容来自网络,如您发现本站内容
侵害到您的利益,请联系本站管理员处理。
联系站长
373515719@qq.com
关于本站:
编程参考手册