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:
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...