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
- alert(divh);
it returns 130
- var divh = document.getElementById("height").offsetHeight;
- if(divh < 400){
$("div.scroll").each(function(){
$(this).removeClass("scroll");
});
}
- <div class="relative">
<div class="scroll">
<section id="height">
- A bunch of code is in here
- </section>
- </div><!--END scroll-->
- </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
- <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?