looping through to remove class

looping through to remove class

I am trying to use jquery to remove the class from a div based on the height of another element. I have a test page set up right now. When I do
  1. alert(divh);

it returns 130


  1. var divh = document.getElementById("height").offsetHeight;
  2. if(divh < 400){
            $("div.scroll").each(function(){
                $(this).removeClass("scroll");
        });
        }
  1. <div class="relative">
          <div class="scroll">
                <section id="height">
  2.                 A bunch of code is in here
  3.             </section>
  4.       </div><!--END scroll-->
  5. </div><!--eND relative-->
I have tried a few different methods. I had it working at one point in time and then found that other pages have failed. this lead me to believe that I needed a loop to look for all
  1. <section class="height">

so, if the height of section is above 400, the div right above it with the class of scroll needs to remove the class="scroll"


What am I doing wrong here?