简体   繁体   中英

jquery dialog with ok and cancel button

in jquery dialog i am only allowed just a single button within a dialog. i want two separate button in this dialog

Script

<script type="text/javascript">
                 $("[id*=btnclosejob]").live("click", function() {
                     $("#dialog").dialog({
                         title: "Job Close?",
                         buttons: {
                             Close: function() {
                                 $(this).dialog('close');
                             }

                         }
                     });
                     return false;
                 });
            </script>

HTML

<asp:Button ID="btnclosejob" runat="server" Text="Close Job"  />

      <div id="dialog" style="display: none">
            Are You Sure You Want to Close this job
      </div>

Result (with just single button "Close" but i want two separate button 1st for Action and 2nd for close the dailog)

在此处输入图片说明

when i click ok button it should redirect to other page

just add another button with comma?

$("[id*=btnclosejob]").live("click", function() {
     $("#dialog").dialog({
         title: "Job Close?",
         buttons: {
             "Close": function() {
                 $(this).dialog('close');
             },
             "OK": function() {
                 window.location = YOUR_URL;
             }
         }
     });
     return false;
});

You can have as many buttons as you wish.

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