How do I select every pair of 2 sequential elements in jQuery?

前端 未结 5 2068
余生分开走
余生分开走 2020-12-20 20:50

Can anyone please help me to work out how to achieve the following? I have a set of divs of unknown size. Each div has a class of .feature. I need to run a jQuery script to

5条回答
  •  自闭症患者
    2020-12-20 21:10

    I used this code to format a set of divs into a two column table:

    $('.feature:even').each(function () {
        $(this).add($(this).next()).wrapAll("");
    });
    $('.feature').wrap('');
    $('tr').wrapAll('');
    

    提交回复
    热议问题