Skip to content

Commit 5ff7bab

Browse files
authored
Update script.js
1 parent f875bb4 commit 5ff7bab

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
const heading = document.getElementById("heading");
22
const button = document.getElementById("clickBtn");
33

4-
const originalText = heading.textContent;
5-
const newText = "Hello World!";
4+
const originalHead = heading.textContent;
65

76
button.addEventListener("click", () => {
8-
if (heading.textContent === originalText) {
9-
heading.textContent = newText;
7+
if (heading.textContent === originalHead) {
8+
heading.textContent = "Changed Heading";
9+
heading.style.backgroundColor = "red";
1010
button.textContent = "Click to Revert";
1111
}
1212
else {
13-
heading.textContent = originalText;
14-
button.textContent = "Click here to Change";
13+
heading.textContent = originalHead;
14+
heading.style.backgroundColor = "lightgrey";
15+
button.textContent = "Click to Change";
1516
}
16-
});
17+
18+
});

0 commit comments

Comments
 (0)