A Pen by Ivan Abramkin

Thumbnail
This awesome code was written by ivanabr, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright ivanabr ©
  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>A Pen by  Ivan Abramkin</title>
  
  
  
  
  
</head>

<body>

  
  
  

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




</body>

</html>

/*Downloaded from https://www.codeseek.co/ivanabr/a-pen-by-ivan-abramkin-mMvmGZ */
function Counter(option) {
    Widget.call(this, option);
    this.container.innerHTML = counterTemplate;
    this.container.querySelector('.counter');
    this.dec = this.container.querySelector('.decrement');
    var count = 0;
    var disp = this.container.querySelector('.counter__display');
    this.dec.onclick = function () {
        count--;
        disp.innerHTML = count;
        }

    this.inc = this.container.querySelector('.increment');
    this.inc.onclick = function(){
        count++;
        disp.innerHTML = count;
    }
}

Comments