give name and value to jquery UI dialog button...
i want to give a name and value to the default button in UI dialog. how can i do tha开发者_如何学运维t ? i would like to give to submit button a value and name!
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 150,
width: 600,
modal: true,
buttons: {
Submit: function() {
document.getElementById('form').submit();
$(this).dialog('close');
},
Cancel: function() {
$(this).dialog('close');
}
}
});
$('#beleg_sichern').click(function() {
$('#dialog').dialog('open');
});
No nice way to do this really since the dialog button constructor only allows you to express the text of the button and the click function.
One way is to set these before submitting the form.
$("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 150,
width: 600,
modal: true,
buttons: {
Submit: function(ev) {
var btn = ev.target;
btn.value = 'someValue';
btn.name = 'someName';
btn.form.submit();
$(this).dialog('close');
},
Cancel: function() {
$(this).dialog('close');
}
}
});
$('#beleg_sichern').click(function() {
$('#dialog').dialog('open');
});
精彩评论