定义和用法

向每个匹配的元素内部前置内容。

语法

prepend(content)
参数描述
content要插入到目标元素内部前端的内容

例子 1

# HTML 代码:
<p>I would like to say: </p>
<p>I would like to say: </p>
<b class="foo">Hello</b>
<b class="foo">Good Bye</b>

# jQuery 代码:
$("p").prepend( $(".foo")[0] );

结果:

<p><b class="foo">Hello</b>I would like to say: </p>
<p><b class="foo">Hello</b>I would like to say: </p>
<b class="foo">Hello</b>
<b class="foo">Good Bye</b>

问题没有解决?建议您查阅官方文档:http://api.jquery.com/prepend/