Gowthamraj Vungarala
Gowthamraj Vungarala

Reputation: 168

How To (wrapInner or wrapAll) Excluding first div class

enter image description here

I want to wrap all the items below "name portlet-title" But, Should not include other items in "div class name portlet-title" below. where i tried following ways:

1) $("div.item").wrapAll('<div class="portlet-body"></div>');

it is effecting all item in page.

2) $("div.list").wrapInner('<div class="portlet-body"></div>');

it is including "div class name portlet-title"

i am not so good at jquery please help me out.

Upvotes: 0

Views: 357

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388406

You need to use a loop so that you can group the items separately.

$('.list.portlet').each(function(){
    $(this).find('div.item').wrapAll('<div class="portlet-body"></div>')
})

Upvotes: 1

Related Questions