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 dialog boxes for user information and input


In Chapter 6, User Interface, you were shown how to create your own modal pop ups. jQuery UI provides an easy-to-use API that helps you to quickly add modals or dialogs to your application. This recipe will look at the default behavior of jQuery UI's dialogs and show you how to use them. Once again, this recipe is designed so that you can easily find the code you need and re-use it at your convenience.

Getting ready

In the chapter9 folder, create recipe-2.html and recipe-2.js and have them open and ready for editing.

How to do it…

To understand how to quickly add dialogs or modals to your application, perform the following steps:

  1. Add the following HTML to recipe-2.html in order to create the button and dialog elements for use within the JavaScript code:

    <!DOCTYPE html>
    <html>
    <head>
       <title>Chapter 9 :: Recipe 2</title>
       <script src="jquery.min.js"></script>
       <script src="jquery-ui/js/jquery...