11

I want to check whether a div with a CSS class="x" has height="auto"

If yes I want (with a jQuery script) the css-class="a" removed from all elements with the css-class="y"

If not the script does not have to do anything. Thanks

2 Answers 2

30
if ($('div.x').css('height') === 'auto') {
    $('.y').removeClass('a');
}
Sign up to request clarification or add additional context in comments.

Comments

7
$(document).ready(function(){
  if ($('div.x').css('height') === 'auto') {
    $('.y').removeClass('a');
  }   

});

You may need to do that within a each() call

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.