How to create a modal with HTML, CSS & JS - Part 3: JavaScript intro

Kevin Powell on YouTubeWatch on YouTube

SaveMark complete

Sign in to save videos and track what you’ve finished.

BeginnerUI14 min

About this video

Shows how to make a modal appear and disappear with vanilla JavaScript by adding and removing a class that changes its display property. It is the third part of a series and sets up a later video on fading the modal in and out.

What you’ll learn

  • Toggle a CSS class with vanilla JavaScript to show or hide an element
  • Use an event listener to open and close a modal
  • Recognise why the next lesson adds fade transitions