Wednesday, August 8, 2012

jQuery UI dialog

 
 
Create a dialog window using jQuery UI 
 
Include following files.
 
 
rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/themes/base/jquery-ui.css">      
rel="stylesheet" type="text/css" href="http://static.jquery.com/ui/css/demo-docs-theme/ui.theme.css">                  
 HTML sample 

 <a id="forgot">Click me to open dialog</a>


<div id="dialog-form" title="Add New ">
    <p class="validateTips">All form fields are required.</p>
    <form id="forgotform" action="/forgotPassword.php" method="post">
    ..................
    </form>
</div

 jQuery


$("#forgot").click(function(e){
    $("#dialog-form").dialog("open");
    e.preventDefault();
});

$("#dialog-form").dialog({
            modal: true,
            autoOpen: false,
            height: 255,
            width: 300,
            buttons: {
                "Retrieve": function() {
                    document.forms["forgotform"].submit();
                },
                Cancel: function() {
                    $( this ).dialog( "close" );
                }
            },
});


demo 

No comments:

Post a Comment