Exercise Solutions: The DOM and EventsΒΆ
When the Take off button is clicked, the text
The shuttle is on the ground
changes toHouston, we have liftoff!
. The Take off button has anid="liftoffButton"
attribute.button.addEventListener('click', event => { paragraph.innerHTML = 'Houston! We have liftoff!'; });
When the user's cursor leaves the Abort Mission button, the button's background returns to its original state (Hint: Setting the background color to the empty string,
""
, will force it to revert to the default browser styles.)missionAbort.addEventListener("mouseout", function( event ) { event.target.style.backgroundColor = ""; });