Creating a modal pop up
A modal is a pop up within a web page that overlays over all other content and focuses the reader's attention. A modal is often opened based on user interaction, such as clicking a button. This recipe will show you how to create a simple modal that is opened at the pressing of a button and can be closed from within the modal.
Once again, create
recipe-10.js before you start this recipe, ensuring that the latest version of jQuery is available in the same directory as these files.
How to do it…
Perform the following steps to create the modal pop up:
- Add the following HTML to
recipe-10.htmlto create a basic web page and the code that constructs the modal pop up:
<!DOCTYPE html> <html> ...