Javascript DOM How to - Get div Inner HTML








Question

We would like to know how to get div Inner HTML.

Answer


<!DOCTYPE html>
<html>
<head>
</head><!--  w  w  w . java  2  s. c  om-->
<body>
  <div class='row' onclick="document.writeln((this).children[0].innerHTML)">
    <div class='label'>Click</div>
  </div>
  <div class='listSeparator'></div>
</body>
</html>

The code above is rendered as follows: