无法使其正常工作,因此适用于每个帖子。围绕除第1段以外的所有段落划分
https://jsfiddle.net/haymanpl/htuczx5q/
<p>This is an example of a WordPress post, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many posts as you like in order to share with your readers what is on your mind.</p>
<div class="text">
<p>This is an example of a WordPress post, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many posts as you like in order to share with your readers what is on your mind.</p>
这是WordPress后的例子,您可以编辑此把有关自己或您网站的信息,让读者知道您来自哪里。您可以创建尽可能多的帖子,以便与您的读者分享您的想法。
</div>
$("p:first-child").after(function() {
return '<div class="text">';
});
这工作,但它增加了,我不想因为我需要使用最后一个孩子将其添加到结束的div标签。
$('p:first-child').after($('<div class="text">'));
我想在一个div中包括多个段落排除第一个。我需要在第一段后插入,然后在最后一段之后关闭。
您不能插入部分或未关闭的标签。 –
你是什么意思“我不想要,因为我需要使用最后孩子添加它”?您是否试图在“span”中包装一个或多个元素?如果是这样,请更新您的问题。 – fubar
你看看'.wrap' for jquery – zgood