Skip to content

Commit 9c31eda

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

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

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

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

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

0 commit comments

Comments
 (0)