Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (40 sloc) 871 Bytes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Events: Task 1</title>
<style>
p {
color: purple;
margin: 0.5em 0;
}
* {
box-sizing: border-box;
}
button {
display: block;
margin: 20px 0 20px 20px;
}
</style>
<link rel="stylesheet" href="../styles.css" />
</head>
<body>
<section class="preview">
</section>
<button class="off">Machine is off</button>
</body>
<script>
let btn = document.querySelector('.off');
btn.addEventListener('click', updateButton)
let off = true;
function updateButton() {
if (off) {
btn.innerHTML = 'Machine is on';
off = false;
} else {
btn.innerHTML = 'Machine is off'
off = true;
}
}
</script>
</html>
You can’t perform that action at this time.