Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript addeventlistener button

/*
HTML
<button id="buttonId" >Click here</button>
*/

document.getElementById('buttonId').addEventListener('click', function(event) {
	const button = event.target;
	button.innerText = (Number(button.innerText) || 0) + 1;
})
Source by www.ingroy.com #
 
PREVIOUS NEXT
Tagged: #javascript #addeventlistener #button
ADD COMMENT
Topic
Name
7+7 =