1252748
1252748

Reputation: 15379

remove all but one element from a div

I'm trying to remove all the elements within a div (.shipping_address_table) except for one table that has the class theTable.

I think I am using the html() wrong here. But it seems like this should be pretty close.

$(this).parents('div#wrapper').find('div.shipping_address_table').html().remove(':not(.theTable)');

Upvotes: 0

Views: 84

Answers (1)

wheresrhys
wheresrhys

Reputation: 23560

$("#wrapper").find('div.shipping_address_table').children(':not(.theTable)').remove();

Upvotes: 1

Related Questions