如何在一个类之后将所有兄弟姐妹封装在一个类中?(jQuery)

如何在一个类之后将所有兄弟姐妹封装在一个类中?(jQuery),jquery,html,css,Jquery,Html,Css,我有一些博客文章,上面有一张特色图片,上面有标题、描述和日期等内容细节 <div id="blog-posts-loop"> <div class="blog-home-wrap"> <div class="blog-home-thumb"> <a href="#" class="su-post-thumbnail"> <img width="500" height="

我有一些博客文章,上面有一张特色图片,上面有标题、描述和日期等内容细节

<div id="blog-posts-loop">

    <div class="blog-home-wrap">
        <div class="blog-home-thumb">
            <a href="#" class="su-post-thumbnail">
            <img width="500" height="300" alt="welcome" class="post-thumbnail" src="src_of_img"></a>
        </div>

        <h2 class="blog-home-post-title">This is a title</h2>
        <div class="blog-home-post-excerpt"></div>
        <div class="blog-home-post-date">November 23, 2015</div>

    </div>

    <div class="blog-home-wrap">
        <div class="blog-home-thumb">
            <a href="#" class="su-post-thumbnail">
            <img width="500" height="300" alt="welcome" class="post-thumbnail" src="src_of_img"></a>
        </div>

        <h2 class="blog-home-post-title">This is a title</h2>
        <div class="blog-home-post-excerpt"></div>
        <div class="blog-home-post-date">November 23, 2015</div>

    </div>

    <div class="blog-home-wrap">
        <div class="blog-home-thumb">
            <a href="#" class="su-post-thumbnail">
            <img width="500" height="300" alt="welcome" class="post-thumbnail" src="src_of_img"></a>
        </div>

        <h2 class="blog-home-post-title">This is a title</h2>
        <div class="blog-home-post-excerpt"></div>
        <div class="blog-home-post-date">November 23, 2015</div>

    </div>

</div>

这是一个标题
2015年11月23日
这是一个标题
2015年11月23日
这是一个标题
2015年11月23日
所需的输出:我希望在每个class=“blog home thumb”之后将所有剩余的详细信息包装为一个带有class的div


这是一个标题
2015年11月23日
这是一个标题
2015年11月23日
这是一个标题
2015年11月23日

感谢您的帮助:)

您可以迭代每个
。blog home thumb
元素,使用选择以下所有同级元素,然后使用:

$('.blog home thumb')。每个(函数(){
$(this.nextAll().wrapAll(“”);
});

您试过什么吗?如果是这样,请告诉我们您的尝试。谢谢你的回答。你太棒了:)
<div id="blog-posts-loop">

    <div class="blog-home-wrap">
        <div class="blog-home-thumb">
            <a href="#" class="su-post-thumbnail">
            <img width="500" height="300" alt="welcome" class="post-thumbnail" src="src_of_img"></a>
        </div>

        <div class="blog-home-content">
            <h2 class="blog-home-post-title">This is a title</h2>
            <div class="blog-home-post-excerpt"></div>
            <div class="blog-home-post-date">November 23, 2015</div>
        </div>

    </div>

    <div class="blog-home-wrap">
        <div class="blog-home-thumb">
            <a href="#" class="su-post-thumbnail">
            <img width="500" height="300" alt="welcome" class="post-thumbnail" src="src_of_img"></a>
        </div>

        <div class="blog-home-content">
            <h2 class="blog-home-post-title">This is a title</h2>
            <div class="blog-home-post-excerpt"></div>
            <div class="blog-home-post-date">November 23, 2015</div>
        </div>

    </div>

    <div class="blog-home-wrap">
        <div class="blog-home-thumb">
            <a href="#" class="su-post-thumbnail">
            <img width="500" height="300" alt="welcome" class="post-thumbnail" src="src_of_img"></a>
        </div>

        <div class="blog-home-content">
            <h2 class="blog-home-post-title">This is a title</h2>
            <div class="blog-home-post-excerpt"></div>
            <div class="blog-home-post-date">November 23, 2015</div>
        </div>

    </div>



</div>
$('.blog-home-thumb').each(function () {
    $(this).nextAll().wrapAll('<div class="blog-home-content"></div>');
});