Reputation: 1317
I can add a button to the dialog with the following code:
var buttonName = "test";
var func = new function(){alert("")};
var buttons = $('#SomeID').dialog('option', 'buttons');
buttons[buttonName] = func;
$('#SomeID').dialog('option', 'buttons', buttons);
But I want my button to also have an ID, how do I add a button with an ID attribute???
Upvotes: 1
Views: 4169
Reputation: 2005
This works for me. You use the buttons array and use the push
function to add another element to it. Now you'll only have to figure out how to attach the functionality to it.
var buttons = $('#content').dialog('option', 'buttons');
buttons.push({text: buttonName, id: 'test', click: function() { alert('Works'); }});
$('#content').dialog('option', 'buttons', buttons);
Upvotes: 7