Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

counter in html and js

<!-- HTML ->
<button id="btn-count">Count</button>
<p id="result"></p>

// JavaScript
const btnCount = document.getElementById('btn-count');

btnCount.addEventListener('click', () => {
  	let counter = 0;
  	counter++;
  	document.getElementById('result').innerText = counter;
});
Source by medium.com #
 
PREVIOUS NEXT
Tagged: #counter #html #js
ADD COMMENT
Topic
Name
8+4 =