-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavascript1.js
More file actions
24 lines (21 loc) · 774 Bytes
/
Copy pathJavascript1.js
File metadata and controls
24 lines (21 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* listItems Strikethrough */
const listItems = document.querySelectorAll("li");
function toggleDone(e) {
if (!e.target.className) {
e.target.className = "done";
} else {
e.target.className = "";
}
}
listItems.forEach((item) => {
item.addEventListener("click", toggleDone);
});
/* Image Toggler */
const Img1 = document.getElementById("Img1");
function ToggleImage() {
if (Img1.getAttribute("src") == "https://mdn.github.io/shared-assets/images/examples/fx-nightly-512.png") {
Img1.setAttribute("src", "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR4K463tqn7xoNRluPEEob5C2EttjVv2REPiBAspV6eoS5qNyY4_npx&usqp=CAE&s");
} else {
Img1.setAttribute("src", "https://mdn.github.io/shared-assets/images/examples/fx-nightly-512.png");
}
}