We would like to know how to set div height to document height.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<style type='text/css'>
div {<!--from w w w. j a v a 2 s.co m-->
width: 600px;
margin: 0 auto;
background: mediumSeaGreen;
}
</style>
<script type='text/javascript'>
$(function(){
function divHeight() {
var dH = $(window).height();
$('div').css({
height: dH
});
}
divHeight();
});
</script>
</head>
<body>
<div></div>
</body>
</html>
The code above is rendered as follows: