2012-04-16 40 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