We would like to know how to get nested div using document.getElementById.
<!DOCTYPE html>
<html>
<body>
<body>
<div id="id1">
<div id="id2"></div>
</div><!--from ww w. j av a 2 s .co m-->
<script type='text/javascript'>
document.writeln(document.getElementById('id2'));
</script>
</body>
</body>
</html>
The code above is rendered as follows: