English 中文(简体)
(JQuery-UI) 是否有办法发现在Close()手递的方言中究竟有什么纽子?
原标题:(JQuery-UI) Is there a way to detect what button was pressed in a dialog s beforeClose() handler?

我的贾瓦文法建立了一个方言箱,要求用户以及两个纽州(K和Cancel)提供某些信息。 我愿使用<代码>dialog s beforeClose 手稿,以便在用户点击Kutton时验证投入(因此,如果用户没有提供适当的投入,他/她仍然“在”方言箱中,并有机会加以纠正)。 是否有办法告诉我的两个纽州中哪一个受到压制? (显然,如果用户使用Cancel,那么就没有必要进行输入验证,方言箱可以紧接着关闭,即我的<代码>可在Close前返回<>true。) 页: 1 有两个投入:<代码>event和ui,但这些投入似乎都没有包含我希望的信息。

最佳回答
问题回答

You simply bind some other functions prior to closing the box (and don t call the close at all if the form doesn t validate). Just add whatever check or ajax calls you need before the $(this).dialog("close"). From: http://jqueryui.com/demos/dialog/#modal-confirmation

<script>
    $(function() {
        // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
        $( "#dialog:ui-dialog" ).dialog( "destroy" );

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




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签