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 originalHead = heading . textContent ;
4+ const originalText = Heading . textContent ;
5+ const newText = "Hello World" ;
56
67button . 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+ } )
You can’t perform that action at this time.
0 commit comments