0

Am having a drop-down with the class name user_status.

On the change event of this seletion, there is a dialog popup is coming. Here is the code.

$('.user_status').change(function(){
    $('#dialog-confirm').dialog({
        title     : 'Change Status',
        resizable : false,
        width     : 250,
        height    : 120,
        modal     : true,
        buttons   : {
            'Yes': function() {
                dialog_obj.dialog('close');
            },
            'No': function() {
                $(this).dialog('close');
            }
        }
    }); 
});

My problem is Its very slow(may take 3 or 4 seconds) to come this popup on the change event. How Can I fast this popup on change event?

4

1 回答 1

1

之前定义您的对话框,然后在这样的事件上打开 jquery 对话框(未经测试的代码):

var jDialog =  $('#dialog-confirm').dialog({
        title     : 'Change Status',
        resizable : false,
        width     : 250,
        height    : 120,
        modal     : true,
        autoOpen  : false,
        buttons   : {
            'Yes': function() {
                dialog_obj.dialog('close');
            },
            'No': function() {
                $(this).dialog('close');
            }
        }
    }); 
$('.user_status').change(function(){
   jDialog.dialog('open');
});
于 2013-02-19T07:25:08.903 回答