2014-09-22 38 views

回答

0

這樣的事情呢? http://jsfiddle.net/jakecigar/0x15b5an/2/

function fnOpenNormalDialog() { 
    // Define the Dialog and its properties. 
    $("#dialog-confirm").dialog({ 
     resizable: false, 
     modal: true, 
     title: "Modal", 
     height: 250, 
     width: 400, 
     create: function (e, ui) { 
      var pane = $(this).dialog("widget").find(".ui-dialog-buttonpane") 
      $("<label class='shut-up' ><input type='checkbox'/> Stop asking!</label>").prependTo(pane) 
     }, 
     buttons: { 
      "Yes": function() { 
       $(this).dialog('close'); 
       callback(true); 
      }, 
       "No": function() { 
       $(this).dialog('close'); 
       callback(false); 
      } 
     } 
    }); 
} 

$('#btnOpenDialog').click(fnOpenNormalDialog); 
$(document).on("change", ".shut-up input", function() { 
    alert("shut up! " + this.checked) 
}) 

function callback(value) { 
    if (value) { 
     alert("Confirmed"); 
    } else { 
     alert("Rejected"); 
    } 
} 
相關問題