Link to home
Start Free TrialLog in
Avatar of hankknight
hankknightFlag for Canada

asked on

jQuery: Test if height greater than min-height

How can I test if the actual height of a div is greater than its minimum height?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>

<style type="text/css">

#d1, #d2 {
width: 120px;
min-height: 200px;
border: 1px solid red;
margin: 20px;
}

</style>
</head>
<body>

<div id="d1">
Hello World
</div>

<div id="d2">
Tdsafads jkadsh kdjsh jkdash kads hakdjsh adkjs hdsjk hafdsj fads jkadsh kdjsh jkdash kads hakdjsh adkjs hdsjk hafdsj fads jkadsh kdjsh jkdash kads hakdjsh adkjs hdsjk hafdsj 
Tdsafads jkadsh kdjsh jkdash kads hakdjsh adkjs hdsjk hafdsj fads jkadsh kdjsh jkdash kads hakdjsh adkjs hdsjk hafdsj fads jkadsh kdjsh jkdash kads hakdjsh adkjs hdsjk hafdsj 
</div>

<script type="text/javascript">

alert('jQuery should be used to test if the height of #d1 height is greater than its min-height')
alert('jQuery should be used to test if the height of #d2 height is greater than its min-height')

</script>

</body>
</html>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gurvinder Pal Singh
Gurvinder Pal Singh
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial