Example 2: Image Modal

Below is an example of how to create a modal (dialog box) that is hidden by default from W3Schools . Using JavaScript we can trigger the modal and to display the current image inside the modal when it is clicked on. Also note that we use the value from the image's "alt" attribute as an image caption text inside the modal.

Snow