tags:

views:

43

answers:

2

Hi All,

I was wondering, how I check if the height of a div is greater than 700px, using Jquery?

Any help would greatly be appreciated. Thanks

+4  A: 
alert($("#theDiv").height() > 700);

Reference: http://api.jquery.com/height/

karim79
You're 8 seconds faster!
BoltClock
@Nick - cheers for getting rid of the extra paren.
karim79
And if you want the reference to the api, it's here: http://api.jquery.com/height/
hellozimi
I'm uber caffeinated :)
karim79
+3  A: 
if ($('#mydiv').height() > 700) {
    // Greater than 700px in height
}
BoltClock
Thanks for your input...I wrote this and it didnt work for some reason...weird huh!if($('#mnu_reports').height() > 700){ }
Nasir
You have to put something in between the curly braces to do something.
BoltClock
I know that...lol...here's my code ------ if($('#mnu_reports').height() > 700){ $(this).css('width','270px'); } ----- Is there something wrong in the syntax?
Nasir
If you're setting the same `<div>`'s width, you need to say `$('#mnu_reports')` instead of `$(this)`.
BoltClock