Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Dom HTML Event - load">
  <meta charset="utf-8">
  <title>DOM HTML Event</title>
</head>
<body>
  
  
</body>
</html>
 
document.addEventListener("DOMContentLoaded", function(event) {
  contentLoaded = true;
  console.log('....');
});
window.onload = function () {
  console.log('****');
  js.log('event type: ', event.type);
  js.log('DOMContentLoaded: ', contentLoaded);
  
};
//////////////////////////////
//// utils
var js = {
  lineNumber: 1
};
js.log = function(text) {
  var node, child, lineText;
  node = document.getElementById('result');
  if (!node) {
    node = document.createElement('div');
    node.id = 'result';
    document.body.appendChild(node);
  }
  child = document.createElement('div');
  lineText = js.lineNumber + '.';
  lineText = Array.isArray(text) ? lineText + '[' + text + ']' : lineText + text;
  if (arguments.length > 1) {
    for (var k = 1; k < arguments.length; k++) {
      lineText += arguments[k];
    }
  }
  child.innerText === undefined ? child.textContent = lineText : child.innerText = lineText;
  node.appendChild(child);
  js.lineNumber += 1;
  return this;
};
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x