The Modal with the <dialog> element
The HTML <dialog> element allows us to easily create a modal or dialog. The modal and the dialog are popups that appear on top of the current page. The biggest difference between these two elements is that when the modal is open you cannot do anything on the current page except scroll. All other interaction is blocked until you close the modal. On the other hand, when the dialog is open you can still interact with the current page. To open the dialog and modal we can use the show() and showModal() JavaScript methods. To close the dialog and modal we can use the close() JavaScript method.