JQuery if then instruction for css value

I want to check if a div with css class = "x" height = "auto". If yes, I want (with jquery script) to remove css-class = "a" from all elements using css-class = "y". If the script does not need to do anything. thanks

+7
javascript jquery css
source share
2 answers
if ($('div.x').css('height') === 'auto') { $('.y').removeClass('a'); } 
+25
source share
 $(document).ready(function(){ if ($('div.x').css('height') === 'auto') { $('.y').removeClass('a'); } }); 

You may need to do this in every () call

+5
source share

All Articles