From the course: jQuery Mobile Essential Training

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Creating and using dialog widgets

Creating and using dialog widgets - jQuery Mobile Tutorial

From the course: jQuery Mobile Essential Training

Start my 1-month free trial

Creating and using dialog widgets

In addition to defining pages in jQuery Mobile, it's also really easy to designate any page as a dialog. And all you need to do to make that happen is use the data-dialog attribute. You put that attribute on the page definition, set it to the value of true, and then that page is treated as if it were a dialog. So let's watch this in action. So over here in the code, in the snippets, I've scrolled down in chapter two to the dialogs section. And let's open up using_dialogs_start. And you can see here that I've got two internal pages. Right, here's the first page. Here's the second page. They've both got data-role of page on them, so without changing anything, let's just go ahead and bring this up in Firefox, and you can see that when there's no dialog definition, it gets treated just as a regular page. Alright, so let's go back to the code. What I'm going to do is, in the snippets, I'm going to copy this data-dialog equals true, and then paste that onto the second page. Alright, so now,…

Contents