Желаемый результат будет таким...
Код: Выделить всё
text
image
item
item
item
text
image
item
item
item
https://jsfiddle.net/e945horw/
Код: Выделить всё
$(".item").each(function() {
$(this).find(".list").nextUntil('.text').andSelf().wrapAll('');
});Код: Выделить всё
.list {
border: 1px solid green;
}Код: Выделить всё
text
image
item
item
item
text
image
item
item
item
Подробнее здесь: https://stackoverflow.com/questions/798 ... er-classes
Мобильная версия