jQuery API | jQuery API 中英文对照版 - jQuery在线查询手册 |
after |
after(content) 在每个匹配的元素之后插入内容。 返回值:jQuery 参数:
在所有段落之后插入一些HTML标记代码。 $("p").after("<b>Hello</b>"); HTML 代码: <p>I would like to say: </p> 结果: <p>I would like to say: </p><b>Hello</b> 示例:在所有段落之后插入一个元素。 $("p").after( $("#foo")[0] ); HTML 代码: <b id="foo">Hello</b><p>I would like to say: </p> 结果: <p>I would like to say: </p><b id="foo">Hello</b> 示例:在所有段落中后插入一个jQuery对象(类似于一个DOM元素数组)。 $("p").after( $("b") ); HTML 代码: <b>Hello</b><p>I would like to say: </p> 结果: <p>I would like to say: </p><b>Hello</b> Insert content after each of the matched elements. Return value: jQuery
Example: Inserts some HTML after all paragraphs. $("p").after("<b>Hello</b>");Before: <p>I would like to say: </p>Result: <p>I would like to say: </p><b>Hello</b> Example: Inserts an Element after all paragraphs. $("p").after( $("#foo")[0] );Before: <b id="foo">Hello</b><p>I would like to say: </p>Result: <p>I would like to say: </p><b id="foo">Hello</b>
Example: Inserts a jQuery object (similar to an Array of DOM Elements) after all paragraphs. $("p").after( $("b") ); Before:
<b>Hello</b><p>I would like to say: </p> Result:
<p>I would like to say: </p><b>Hello</b> |