When clicking this:
$('.hor_edit').live('click', function(e) {
e.preventDefault();
var name = $(this).attr('name');
$('#dialog-for开发者_JS百科m-horario').dialog('open');
});
I want to check the variable when clicking another button inside the dialog:
$('#dialog-form-horario').dialog({
resizable: false,
autoOpen: false,
modal: true,
buttons: {
'Agregar': function() {
alert(name);
}
},
close: function() {
}
});
I've read the documentation but seems not clear to me.
Try
var name = $(this).attr('name');
$('#dialog-form-horario').data('name', name);
$('#dialog-form-horario').dialog('open');
and
'Agregar': function() {
alert($(this).data('name'));
}
精彩评论