Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>jQuery Mobile: Open and Close Dialog Box Programmatically</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
  7. <script src="http://code.jquery.com/jquery-2.1.3.js"></script>
  8. <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>
  9. <script type="text/javascript">
  10. $(document).bind("pageinit", function() {
  11.  
  12. $('#openDialog').bind("tap", function() {
  13. $.mobile.changePage("#page2", {
  14. role: "dialog" // show #page2 as dialog
  15. })
  16. })
  17.  
  18. $('#closeDialog').bind("tap", function() {
  19. $('#page2').dialog("close") // close #page2
  20. })
  21.  
  22. $('#okButton').bind("tap", function() {
  23. $.mobile.changePage("#page3") // go to #page3
  24. })
  25.  
  26. });
  27.  
  28. </script>
  29. </head>
  30. <body>
  31. <div id="page1" data-role="page">
  32. <div data-role="header">
  33. <h1>Jacqui's Shop</h1>
  34. </div>
  35. <div data-role="content">
  36. <button id="openDialog">Show the dialog</button>
  37. </div>
  38. </div>
  39. <!-- dialog #page2 -->
  40. <div id="page2" data-role="page">
  41. <div data-role="header">
  42. <h1>jQuery Mobile Tutorials</h1>
  43. </div>
  44. <div data-role="content">
  45. This is the content area of the dialog
  46. <button id="okButton">OK</button>
  47. <button id="closeDialog">Close</button>
  48. </div>
  49. </div>
  50.  
  51. <!-- dialog #page3-->
  52. <div id="page3" data-role="page">
  53. <div data-role="header">
  54. <h1>jQuery Mobile</h1>
  55. </div>
  56. <div data-role="content">
  57. Welocome to jQuery Mobile Tutorials -- You came here via the Dialog Box
  58. </div>
  59. </div>
  60. </body>
  61. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement