插入文本.before()使用jquery INSIDE标记

pan*_*uli 2 jquery insert

这是我正在尝试做的一个基本示例:

<div class="container">
  <h2>Greetings</h2>
  <p>All this content, including the HTML comes from a CMS</p>
</div>
Run Code Online (Sandbox Code Playgroud)

我想从CMS中插入更多内容,就像这样

<div class="container">
  <h2>Greetings</h2>
  <p>NEW YORK - December 29, 2010 - All this content, including the HTML comes from a CMS</p>
</div>
Run Code Online (Sandbox Code Playgroud)

这个标签不起作用,因为它会把它放在之前

标签...

$('.container p').before('NEW YORK - December 29, 2010');
Run Code Online (Sandbox Code Playgroud)

那我怎么能把它插入标签?我无法用类标记p或在标记内放置标记

标签,因为它正在从CMS中吐出.

pan*_*uli 12

我找到了prepend(),它似乎做了我想要的.这也是另一种解决方案.谢谢!!http://api.jquery.com/prepend/