jQuery API | 返回首页目录 | jQuery API 中英文对照版 |
insertAfter(expr) |
insertAfter(expr)
把所有匹配的元素插入到另一个、指定的元素元素集合的后面。 实际上,使用这个方法是颠倒了常规的$(A).after(B)的操作,即不是把B插入到A后面,而是把A插入到B后面。 返回值:jQuery 参数:
示例: 与 $("#foo").after("p")相同 $("p").insertAfter("#foo"); HTML 代码: <p>I would like to say: </p><div id="foo">Hello</div> 结果: <div id="foo">Hello</div><p>I would like to say: </p> Insert all of the matched elements after another, specified, set of elements. This operation is, essentially, the reverse of doing a regular $(A).after(B), in that instead of inserting B after A, you're inserting A after B. Return value: jQuery
Example: Same as $("#foo").after("p") $("p").insertAfter("#foo");Before: <p>I would like to say: </p><div id="foo">Hello</div> Result: <div id="foo">Hello</div><p>I would like to say: </p> |