Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery remove class

Tags:

jquery

i got a class,

div.domtab div{
        clear:both;
        width:auto;
        background:#eee;
        color:#000;
        padding:1em 1.5em;
    }

and i cannot change it, and i not able to remove it i tried

$('#tag1').removeClass();
$('#tag1').removeClass('.domtab');
$('#tag1').removeClass('div.domtab');
$('#tag1').removeClass('div.domtab div');

but it still not working. clear:both cause all my div not float left.....

like image 673
Leon Avatar asked Dec 09 '25 23:12

Leon


2 Answers

Considering your markup is like:

<div class="domtab">
  ...
  <div id="tag1"></div>
  ...
</div>

You can remove the class by

$('#tag1').closest('.domtab').removeClass('domtab');

like image 139
kapa Avatar answered Dec 11 '25 13:12

kapa


try $('#tag1').removeClass('domtab');

like image 28
Gal Avatar answered Dec 11 '25 12:12

Gal



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!