-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreating-elements.js
More file actions
23 lines (22 loc) · 1.08 KB
/
creating-elements.js
File metadata and controls
23 lines (22 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
!(function () {
const AutobotButton = document.createElement("button");
AutobotButton.textContent = "Autobot";
AutobotButton.style.backgroundColor = "red";
AutobotButton.style.color = "white";
AutobotButton.classList.add("Autobot");
document.querySelector("body").appendChild(AutobotButton);
document.querySelector(".Autobot").addEventListener("click", event => {
const AutobotText = document.querySelector("#Autobot");
AutobotText.textContent = alert(`Freedom is the right of all Sentient Beings! You are an Autobot`);
});
const DecepticonButton = document.createElement("button");
DecepticonButton.textContent = "Decepticon";
DecepticonButton.style.backgroundColor = "purple";
DecepticonButton.style.color = "white";
DecepticonButton.classList.add("Decepticon");
document.querySelector("body").appendChild(DecepticonButton);
document.querySelector(".Decepticon").addEventListener("click", event => {
const DecepticonText = document.querySelector("#Decepticon");
DecepticonText.textContent = alert(`Peace through tyranny! You are a Decepticon.`);
});
})();