Reputation: 3663
I have the following:
<div id="preview_invoice_container">
<table class="page_container">
<tr>
<td width="30%" id="position_0" class="box_container">
<div class="box_logo"></div>
</td>
<td width="30%" id="position_1">
<div class="box_logo"></div>
</td>
<td width="30%" id="position_2"></td>
</tr>
</table>
And I want to remove all occurences of the class="box_logo" only inside the div="preview_invoice_container"
I've tried the following : $('#preview_invoice_container').find('.box_logo').removeClass("box_logo");
But its not working. Any help will be appreciated.
Upvotes: 3
Views: 761
Reputation: 2881
$('div.box_logo', '#preview_invoice_container').remove();
Upvotes: 0
Reputation: 53311
Remove all occurrences of elements with the class .box_logo
from within the specified ID:
$('#preview_invoice_container .box_logo').remove();
Upvotes: 1
Reputation: 39649
.removeClass()
actually removes the specified class from all matched elements, it doesn't remove the elements themselves. I think what you want is:
$('#preview_invoice_container').find('.box_logo').remove();
Upvotes: 5