Search notes:

DOM example: document.getElementById

document.getElementById('xyz') returns the node in a document whose id attribute has the value xyz.
The returned object inherits from Element.
<!DOCTYPE html>
<html>
<head>
  <meta content="text/html;charset=utf-8" http-equiv="Content-Type">
  <title>document.getElementById</title>

<script type="text/JavaScript">

function main() { try {
   var elem = document.getElementById('out');

   elem.innerHTML = "typeof(elem) = " + typeof(elem);

 } catch(e) {alert (e);}
}


</script>

</head>
<body onload='main();'>

  <div id='out'></div>

</body>
</html>

Github repository about-Document-Object-Model, path: /Node/Document/getElementById.html

See also

document.getElementsByName('abc') returns an array of elements whose name attribute is abc.
document.getElementsByTagName('div') returns an array of the <div> elements in a HTML document.
DOM examples

Index