Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery removeClass doesn't remove associated styles

Tags:

jquery

I have a div with some class and I add some css using Jquery

$('.myClass').css("position","absolute");

After few steps I remove the class myClass, using

$('.myDiv').removeClass('myClass');

But the style position:absolute is not removing.

Any help will be much appreciated.

like image 656
Ajai Avatar asked Oct 19 '22 10:10

Ajai


1 Answers

Please use removeAttr( 'style' ) .

Which is the jquery function to remove the element.style.

like image 78
Abin Abraham Avatar answered Jan 04 '23 07:01

Abin Abraham