2012-04-16 44 views
2

我想啓用一個按鈕後,我打開了一個jquery對話框,選項模態設置爲true。該按鈕顯然是在對話框外。我已經知道這似乎是一個奇怪的請求,但我需要這種行爲,因爲我在對話框中有一個表單,所以點擊按鈕提交數據後,我必須在表單末尾添加對話框,然後單擊agin在現在位於對話框之外的按鈕上。打開jQuery對話框後打開一個按鈕模式真正

預先感謝您。

+0

對SEO :) – Val 2012-04-16 13:25:47

回答

2
每當對話框打開

$(".selector").dialog({ 
    open: function(event, ui) { 
     $('#yourhiddenbutton').show(); 
    } 
}); 

編輯被解僱

使用TE open事件 - 你可以做這樣的

$(function() {    
    $("#dialogRifiuto").dialog({ 
     width: 'auto', 
     autoOpen: true, 
     closeOnEscape: true, 
     modal: true, 
     resizable: false, 
     open: function(){ 
      //change the z-index and position the div where you want 
      $('#a').css({'z-index': 1005, 'position': 'absolute', 'top': 0 });    
     }, 
     close: function(){ 
      //go back to normal 
      $('#a').css({'z-index': 1, 'position': 'static' });   
     } 

    }) 

}); 
+0

@FlorianMargaine哈哈哈好,他可能還需要改變中的z-index'因爲這將是下面的和無用的 – Val 2012-04-16 13:26:18

+0

我需要的是能夠阻止模式jQuery的對話框按鈕(按鈕是不在對話框中)。使用該代碼,我只能在對話框中顯示一個按鈕。 – 2012-04-16 13:49:55

+0

@RobertodeSantis我只是建議你使用open事件,代碼只是指出你應該做些什麼,我沒有真正明白你的用例,但我認爲你應該改變z-index按鈕或類似的東西 – 2012-04-16 13:54:51

0

您可以啓用使用 $(按鈕「#爲myButton ').removeAttr(' 禁用');

+0

不是那麼簡單 – 2012-04-16 14:05:56

+0

哇,你真的需要處理你的問題。你也可以使用'$('#button')。attr('disabled',false);' – Val 2012-04-16 14:19:21