Open dialog as popup
Description
The following code shows how to open dialog as popup.
Example
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.9.1.js'></script>
<script type="text/javascript"
src="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.js"></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.3.0-beta.1/jquery.mobile-1.3.0-beta.1.css">
</head><!-- ww w . ja v a 2s .c o m-->
<body>
<div data-role="page" id="page">
<div data-role="header" data-theme="b">
<h1>Header</h1>
</div>
<div class="ui-bar ui-bar-d">
<h3>Sub-header</h3>
</div>
<div data-role="content">
<form>
<input type="submit" value="Open dialog as popup" />
</form>
</div>
</div>
<div data-role="dialog" id="dialog">
<div data-role="header" data-theme="b">
<h1>Dialog title</h1>
</div>
<div data-role="content">
<h2>Dialog message</h2>
<p>Dialog message text</p>
</div>
</div>
<script type='text/javascript'>//<![CDATA[
$('#page').on('pageinit', function (event) {
$('#page form').on('submit', function () {
$.mobile.changePage('#dialog', {'role': 'dialog'});
return false;
});
});
//]]>
</script>
</body>
</html>