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

返回值:jqueryprependto(content)

概述

把所有匹配的元素前置到另一个、指定的元素元素集合中。

实际上,使用这个方法是颠倒了常规的$(a).prepend(b)的操作,即不是把b前置到a中,而是把a前置到b中。

在jquery 1.3.2中,appendto, prependto, insertbefore, insertafter, 和 replaceall这个几个方法成为一个破坏性操作,要选择先前选中的元素,需要使用end()方法,参见 appendto 方法的例二。

参数

contentstring

用于匹配元素的jquery表达式

示例

描述:

把所有段落追加到id值为foo的元素中。

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