function increase a number by click javascript

Solutions on MaxInterview for function increase a number by click javascript by the best coders in the world

showing results for - "function increase a number by click javascript"
Aksel
12 Feb 2017
1<body>
2    <div id="poke"><button>click here</button></div>
3    <div id="counter">0</div>
4
5
6    <script type='text/javascript'>
7    var poke = document.getElementById('poke');
8    var cmp = document.getElementById('counter');
9    poke.addEventListener('click', myfonction)
10
11
12
13
14    //===========================================================
15    function myfonction() {
16      cmp.innerHTML = parseInt(cmp.innerHTML) +1;
17
18
19    }
20
21    </script>
22
23  </body>