Coding task · JavaScript and TypeScript course · Module 8: Events and the DOM

Exercise: Modal Dialog

Create an interactive modal with dinosaur information.

Task

The index.html file has a #open-modal button and a hidden modal dialog #dino-modal (style.css shows it only with the open class). Fill in the blanks in the script: ___BLANK1___ is the classList method that adds the open class when the button is clicked, ___BLANK2___ is the key press event listened to on the document, and ___BLANK3___ is the event.key value of the Escape key. The dialog should open on click and close when Escape is pressed, but not when another key is pressed.