返回值: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>