Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript click counter

## MY HTML
<button id='counter'>Click Me To Count</button>
<span id='result'>1</span>

## MY JAVASCRIPT
let counter = document.getElementById("counter")
let result = document.getElementById("result")
let count = 1

counter.addEventListener("click", () => {
  count += 1
  result.innerHTML = count
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: check if isset variable js 
Javascript :: conditional style prop react 
Javascript :: using .env in cra 
Javascript :: js object using variable as key 
Javascript :: react script 
Javascript :: contains() js 
Javascript :: react google map 
Javascript :: how set defualt image for dropify 
Javascript :: how to use uniqid 
Javascript :: get domain name with regex 
Javascript :: what is currying in javascript 
Javascript :: remove all duplicates from an array 
Javascript :: reactjs cut part of string 
Javascript :: regex remove duplicates 
Javascript :: discord.js.Client 
Javascript :: javascript regex 
Javascript :: javascript loop object 
Javascript :: push data to firebase javascript 
Javascript :: ts node cannot use import statement outside a module 
Javascript :: create react app command 
Javascript :: sort an array of objects in javascript 
Javascript :: window.addeventlistener 
Javascript :: find all voice chanels in category 
Javascript :: minify html using javascript 
Javascript :: remove .html from url express js 
Javascript :: javascript loop x times 
Javascript :: gesture handling with react native expo 
Javascript :: remove selected js 
Javascript :: get thumbnail from video js 
Javascript :: mongodb replace root 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =