jquery dialog: confirm the click on a submit button

Posted by Omu on Stack Overflow See other posts from Stack Overflow or by Omu
Published on 2010-05-21T11:45:33Z Indexed on 2010/05/21 11:50 UTC
Read the original article Hit count: 132

Filed under:

I'm trying to do a confirm dialog using jquery, but the form doesn't get submitted at all, this is what I got:

    <script type="text/javascript">
        $(function() {
            $("#dialog-confirm").dialog({
                resizable: false,
                height: 140,
                modal: true,
                autoOpen: false,
                buttons: {
                    'Delete all items': function() {
                        $(this).dialog('close');
                        return true;
                    },
                    Cancel: function() {
                        $(this).dialog('close');
                        return false;
                    }
                }
            });
        });

        function ask() {
            $("#dialog-confirm").dialog('open');
        }
    </script>
<form ... >
    <input type="submit" value="delete" onclick="ask();return false;" />
</form>

© Stack Overflow or respective owner

Related posts about jQuery