Link to home
Create AccountLog in
Avatar of Neil_Bradley
Neil_BradleyFlag for New Zealand

asked on

Find the height of a div using jquery

I would like to set the height of a div (id="main") to the same height as a div (id="pageContents") minus 120px.
To summarize:
height of #main is equal to the height of #pageContent -120px.
Can anyone assist?
N
Avatar of leakim971
leakim971
Flag of Guadeloupe image

$("#main").height( $("pageContent").height() );

Or try :

$("#main").css("height",  $("pageContent").css("height") );
Avatar of Neil_Bradley

ASKER

How could this be modified to subtract 120px from the #main?
IE
$("#main").height( $("pageContent").height() -"120");
ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Perfect thanks,
Cheers,
Neil