2010-07-08 159 views
1

嗯,我回來了...我試圖讓jQuery UI的按鈕和對話框插件與我的表單一起工作。我想重置按鈕jQuery UI對話框和按鈕刷新

<button id="opener" value="reset" type="submit">Reset</button> 

拉起確認對話框,它做。取消應該關閉對話框並將按鈕設回原來的狀態。它解散罰款,但按鈕保持其懸停狀態,即使我已經嘗試添加.refresh方法幾乎無處不在我能想到的。

jQuery(document).ready(function($) { 

$(".dialog").dialog({ 
      autoOpen: false, 
      resizable: false, 
      modal: true, 
      title: 'Warning!', 
      close: function() { 
       $('#opener').button('refresh'); 
       }, 
      buttons: { 
       'Continue': function() { 
        $(this).dialog('close');  
       }, 
       Cancel: function() { 
        $(this).dialog('close'); 
        $('#opener').button('refresh') 
       } 
      } 
     }); 


$('#opener').click(function() { 
      $('.dialog').dialog('open'); 
      $(this).button('refresh') 
      return false; 
     }); 
}); 

然後在一個繼續響應按鈕應該繼續其原來的目的..哪些沒有發生。我得到一個回報:錯誤的行爲w/o返回:任何地方爲false。

回答

1

有人在jQuery的論壇上回答我的第一部分,我需要

close: function() { 
$('#opener').removeClass('ui-state-focus'); 
}, 

添加到對話框的命令。和

$('#myform').submit(); 

到了繼續功能