제대로 작동하지 않아 각 게시물에서 작동합니다. 독자가 당신이 어디에서 오는지 알 수 있도록 첫 번째 단락을 제외한 모든 단락을 둘러싸는 단락
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>
이것은 워드 프레스 포스트의 예입니다
, 당신은 자신 또는 귀하의 사이트에 대한 정보를 넣어 이것을 수정할 수 있습니다. 마음에 들는 독자와 공유하기 위해 원하는만큼의 게시물을 작성할 수 있습니다.</div>
$("p:first-child").after(function() {
return '<div class="text">';
});
이 작동하지만 내가 마지막으로 아이를 사용하여 추가 할 필요로 내가 원하지 않는 닫는 div 태그를 추가합니다.
$('p:first-child').after($('<div class="text">'));
나는 첫 번째 부분을 제외한 div에 여러 개의 단락을 감싸려고합니다. 첫 번째 단락 뒤에 삽입 한 다음 마지막 단락 뒤에 삽입해야합니다.
부분 또는 닫혀 있지 않은 태그는 삽입 할 수 없습니다. –
"마지막 아이를 사용하여 추가해야하므로"하고 싶지 않습니다. 'span'에 하나 이상의 요소를 래핑하려고합니까? 그렇다면 질문을 업데이트하십시오. – fubar
나중에 jquery에 대해'.wrap'을보십시오 – zgood