Skip to content
Snippets Groups Projects
Commit ed184eff authored by Minhao Qiu's avatar Minhao Qiu
Browse files

udpate

parent 2174916d
No related branches found
No related tags found
No related merge requests found
document.addEventListener('DOMContentLoaded', function() {
document.querySelector('button').onclick = count;
});
let counter = 0;
function count() {
counter++;
document.querySelector(`#counter`).innerHTML = counter;
if (counter % 10 === 0) {
alert(`Counter is at ${counter}!`);
}
}
<!DOCTYPE html>
<html>
<head>
<script src="counter.js"></script>
<title>My website</title>
</head>
<body>
<h1 id="counter">0</h1>
<button>Click here!</button>
</body>
</html>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment