Could you please share your full working code(hiding buttong or showing dynamic button)
cjdell wrote: > > Here is the code to do what you ask: > > $.extend($.ui.dialog.prototype, { > 'addbutton': function(buttonName, func) { > var buttons = this.element.dialog('option', 'buttons'); > buttons[buttonName] = func; > this.element.dialog('option', 'buttons', buttons); > } > }); > > $.extend($.ui.dialog.prototype, { > 'removebutton': function(buttonName) { > var buttons = this.element.dialog('option', 'buttons'); > delete buttons[buttonName]; > this.element.dialog('option', 'buttons', buttons); > } > }); > > Add it into into a helper JS file if you wish. Usage: > > $('#MyDialog').dialog('removebutton', 'Old Button'); > $('#MyDialog').dialog('addbutton', 'New Button', newButtonClickFunction); > > function newButtonClickFunction() { > alert('You clicked the new button!'); > } > > > honzaB-3 wrote: >> >> >> Hi, >> >> I have created a simple modal form in dialog and I want to update the >> buttons according to some events in the form. More specifically I do >> an ajax request and I want to remove "Send" button after it's clicked. >> >> Is there a simple way to do this? >> >> Thanks for replies, >> >> Jan Brucek >> >> ----- The dialog is specified like this: >> >> $('#contactform').dialog({ >> bgiframe: true, >> autoOpen: false, >> width: 490, >> modal: true, >> overlay: { >> backgroundColor: '#FFFFFF', >> opacity: 0.5 >> }, >> buttons: { >> "Send": function() { >> $('#form_contact_form').ajaxSubmit(contactformoptions); >> }, >> "Cancel": function() { >> $(this).dialog("close"); >> } >> } >> }); >> >> $('#contact_form_link').click(function(){ >> // REMOVE THE "Send" BUTTON HERE.. HOW? >> } >> >> --~--~---------~--~----~------------~-------~--~----~ >> You received this message because you are subscribed to the Google Groups >> "jQuery UI" group. >> To post to this group, send email to jquery-ui@googlegroups.com >> To unsubscribe from this group, send email to >> jquery-ui+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/jquery-ui?hl=en >> -~----------~----~----~----~------~----~------~--~--- >> >> >> > > -- View this message in context: http://old.nabble.com/jQuery-dialog-add-remove-button-on-the-fly-tp22036498s27240p29004704.html Sent from the jQuery UI Discussion mailing list archive at Nabble.com. -- You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to jquery...@googlegroups.com. To unsubscribe from this group, send email to jquery-ui+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en.