A Pen by Sean Corbett

Thumbnail
This awesome code was written by Corpheus91, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright Corpheus91 ©

Technologies

  • HTML
  • CSS
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Sean Corbett</title>
  
  
  <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css'>

      <link rel="stylesheet" href="css/style.css">

  
</head>

<body>

  <div id="app">
</div>
  <script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react-dom.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.6.1/react.min.js'></script>

  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/Corpheus91/a-pen-by-sean-corbett-wpzWLQ */
h1{
  cursor: pointer;
}

/*Downloaded from https://www.codeseek.co/Corpheus91/a-pen-by-sean-corbett-wpzWLQ */
var mainDiv = document.getElementById("app");
var h1 = document.createElement('H1');
h1.innerHTML = "Click me!";

var val = 0;
var dataItem = document.createElement('h4');
dataItem.innerHTML = val.toString();
h1.appendChild(dataItem);
mainDiv.appendChild(h1);

h1.onclick = function () {
  val += 1;
  document.getElementsByTagName('H4')[0].innerHTML = val.toString();
};

Comments