Chapter 4. Dialog Boxes
Dialog boxes are interesting solutions for presenting information on an HTML page. You can use dialog boxes, for example, to pose a question to the user. HTML dialog boxes have the traditional behavior of other application dialog boxes—you can move, resize, and of course, close them.
Basic Principles of Dialog Boxes
Suppose we want to write the HTML code to display the dialog box shown in Figure 4-1.

Figure 4-1. An HTML dialog box
This dialog box includes text content and a title bar that contains a close button. Users can move the box on the page and resize it. jQuery UI requires us to use the following conventions:
A global
<div>block surrounds the whole with a title attribute that specifies the window title.The
<div>content includes the content of the window.
<!DOCTYPE html> <script src = jquery.js></script> <script src = jqueryui/js/jquery-ui-1.8.16.custom.min.js></script> <link rel=stylesheet type=text/css href=jqueryui/css/smoothness/jquery-ui-1.8.16.custom.css /> <div id="dialog" title="Window title"> <p> Content of the dialog box </p> </div> <script> $("#dialog").dialog(); </script>
The dialog () method transforms
the HTML code written on the page into HTML code to display a dialog
box.
Notice the <! DOCTYPE html>
header in HTML. If this statement is not present, window management is
done poorly in Internet Explorer.
To display multiple dialog boxes simultaneously, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access