Book Image

jQuery 2.0 Development Cookbook

By : Leon Revill
Book Image

jQuery 2.0 Development Cookbook

By: Leon Revill

Overview of this book

Table of Contents (17 chapters)
jQuery 2.0 Development Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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.

Getting ready

Once again, create recipe-10.html, recipe-10.css, and 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:

  1. Add the following HTML to recipe-10.html to create a basic web page and the code that constructs the modal pop up:

    <!DOCTYPE html>
    <html>
    <head>
        <title>Chapter 6 :: Recipe 10</title>
        <link href="recipe-10.css" rel="stylesheet" type="text/css" />
        <script src="jquery.min.js"></script>
        <script src="recipe-10.js"&gt...