Remove Element with multiple Class without ID

3.4k Views Asked by At

Been Googling and couldn't find the answer. How do I go about removing THIS specific div and child after that, without an id (it was generated by WijGrid)

<div class="wijmo-wijsuperpanel-vbar-buttontop ui-state-default ui-corner-tr">
    <span class="ui-icon ui-icon-triangle-1-n"></span>
</div>

I tried, but no go

$('.wijmo-wijsuperpanel-vbar-buttontop .ui-state-default .ui-corner-tr').remove();

Thanks in advance!

2

There are 2 best solutions below

3
On BEST ANSWER

Just remove the spaces in your selector:

$('.wijmo-wijsuperpanel-vbar-buttontop.ui-state-default.ui-corner-tr').remove();

With the spaces, it would select elements with ui-corner-tr class inside an element with ui-state-default class inside an element with wijmo-wijsuperpanel-vbar-buttontop class.

0
On

Remove whitespaces, otherwise you're asking for descendents and not elements containing ALL classes.

$('.wijmo-wijsuperpanel-vbar-buttontop.ui-state-default.ui-corner-tr').remove();