获取打开对话框的按钮的 ID
Get the id of the button which opens the dialog
我在 table 的每一行中都有一个按钮,在 loop.The 按钮中生成了 class click_link
。每行的 ID 都不同。单击按钮时,jquery 对话框是 created.I 需要对话框按钮 click()
内的按钮 ID,即编辑按钮的单击事件
$("#dialog_loader").dialog({resizable: false,
height:"auto",
modal: true,
minWidth: 500,
autoOpen:false,
buttons: {
"Edit": function() {
$.ajax({
url:url1,
type:'POST',
data:data1,
success:function(msg){
if(msg)
{
//alert(msg);
//Here I need to get the id of the button which creates
the dialog.That is id of the button with class **click_link**
}
}
});
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
//click event of button
$(document).on('click','.click_link',function(){
$("#dialog_loader").css({'display':'show'});
$('#dialog_loader').dialog('open');
});
设置data()
属性为对话框的id
$('#dialog_loader').data('dialog_opener',"id of the button which create dialog").dialog('open');
然后调用
$("#dialog_loader").data("id of the button which create dialog")
在需要的地方
我在 table 的每一行中都有一个按钮,在 loop.The 按钮中生成了 class click_link
。每行的 ID 都不同。单击按钮时,jquery 对话框是 created.I 需要对话框按钮 click()
内的按钮 ID,即编辑按钮的单击事件
$("#dialog_loader").dialog({resizable: false,
height:"auto",
modal: true,
minWidth: 500,
autoOpen:false,
buttons: {
"Edit": function() {
$.ajax({
url:url1,
type:'POST',
data:data1,
success:function(msg){
if(msg)
{
//alert(msg);
//Here I need to get the id of the button which creates
the dialog.That is id of the button with class **click_link**
}
}
});
},
Cancel: function() {
$( this ).dialog( "close" );
}
}
});
//click event of button
$(document).on('click','.click_link',function(){
$("#dialog_loader").css({'display':'show'});
$('#dialog_loader').dialog('open');
});
设置data()
属性为对话框的id
$('#dialog_loader').data('dialog_opener',"id of the button which create dialog").dialog('open');
然后调用
$("#dialog_loader").data("id of the button which create dialog")
在需要的地方