KEEP IN TOUCH BLOG HOME


Jul 14
2011
Written By psmith
Leave a Comment
jQuery syntax for creating a dialog - here goes a quick code snippet. This is includes the open parameter to override the default css overlay code and the button parameter to set the logic of what happens when the close button is clicked. It also includes other miscellaneous settings.

First be sure to include references to Jquery libraries jquery and jquery-ui like the following. These are the versions I used.

<script src="../Scripts/jquery-1.4.2.js" type="text/javascript"></script>
<script src="../Scripts/jquery-ui-1.8.4.custom.js" type="text/javascript"></script>


This Code should be placed inside your function  $(document).ready(function () {
$("#TestDialog").dialog({
                autoOpen: false,
                bgiframe: true,
                width: 785,
                modal: true,
                open: function () {
                   $('.ui-widget-overlay').css({ opacity: .20 });
                },               
buttons: {                   
"Close": function () {                       
$(this).dialog('close');                   
}               
}           
});


Use this code to actually pop the open the dialog.
 $("#TestDialog").dialog('open');

Posted in Jquery
Tagged Jquery


Global Gains, inc. 2008