简体   繁体   中英

Dialogue box in jQuery not working?

Here is my dialogue box code which using jQuery

    $(document).ready(function(){
       function showDialog() {
        $("#Close").dialog({
            resizable: true,
            height: 140,
            modal: true,
            position: 'center',
            buttons: {
                'Yes': function () {
                    $(this).dialog("close");
                    return true;
                },
                'No': function () {
                    $(this).dialog("close");
                    return false;
                }
            }
        });
    };

    $('#Open').click(function(){
    alert('Hellp');
    //    showDialog();
    });
});

But does is not working? Here is my jsfiddle - http://jsfiddle.net/zjRga/349/

In your code you never actually invoke the dialog. Notice this:

alert('Hellp');
//    showDialog();

You're showing a standard alert instead of calling your showDialog function. When I swap out those lines as comments in your jsFiddle , it seems to work:

//alert('Hellp');
showDialog();

I understand that you may need to check the tags. They are perfectly close. Hence, I would like to suggest you check the opening and closing tags. Meanwhile I have checked your code jsfiddle and make necessary adjustments.

You can check this here [http://jsfiddle.net/zjRga/353/]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM