File tree Expand file tree Collapse file tree
task01-change-and-revert-heading Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const heading = document . getElementById ( "heading" ) ;
22const button = document . getElementById ( "clickBtn" ) ;
33
4- const originalText = heading . textContent ;
5- const newText = "Hello World!" ;
4+ const originalHead = heading . textContent ;
65
76button . 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+ } ) ;
You can’t perform that action at this time.
0 commit comments