Jquery Dialog Widget Example - Jquery
How to create jquery dialog widget?
Snippet Code
This jquery code creates a dialog box which displays your alert information. The below code creates a dialog widget by using jquery ui.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Jquery Dialog Widget Example..</title>
<link href="http://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<!-- CSS -->
<style>
.ui-widget-header,.ui-state-default, ui-button{
background:#87DBDB;
border: 1px solid #6ECCC2;
color: #FFFFFF;
font-weight: bold;
}
</style>
<!-- Javascript -->
<script>
$(function() {
$( "#dialog-2" ).dialog({
autoOpen: false,
buttons: {
OK: function() {$(this).dialog("close");}
},
title: "Success",
position: {
my: "center center",
at: "center center"
}
});
$( "#opener-2" ).click(function() {
$( "#dialog-2" ).dialog( "open" );
});
});
</script>
</head>
<body>
<!-- HTML -->
<div id="dialog-2" title="Dialog Title goes here...">Welcome to Hscripts.com</div>
<button id="opener-2"> Click Here</button>
</body>
</html>
Tags