Thank you so much. It's great. Very concise and to-the-point. I went to jQuery UI's documentation page and didn't see anything like what you said. (http://docs.jquery.com/UI/Dialog) Should I go to the source code to dig out all possible methods of a given jquery ui widget or there is a better documentation somewhere else?
I appreciate it! On Dec 13, 1:50 am, "Richard D. Worth" <[email protected]> wrote: > All jQuery UI plugin options can be accessed (get and set) after > initialization through the API. In 1.5 like so > > var buttons = dlg.data("buttons.dialog"); > > In 1.6 in addition to .data("optionKey.pluginName", [newOptionValue]), there > is an option method > > var buttons = dlg.dialog("option", "buttons"); > > Here's a full example of what you describe with 1.6: > > var dlg = $('<div><a href="#">click</a></div>').dialog({ > buttons: { > "Ok": function() { alert('You clicked Ok'); }, > "Cancel": function() { alert('You clicked Cancel'); } > } > > }); > > dlg.find("a").click(function() { > dlg.dialog("option", "buttons")['Ok'].apply(dlg); > > }); > > Note: that final dlg parameter passed to .apply() is to provide the correct > 'this' context inside the Ok callback function. > > - Richard > > On Fri, Dec 12, 2008 at 11:31 AM, Jay W <[email protected]> wrote: > > > I have a dialog created using ".dialog" method from jquery UI. There > > are two buttons created: "Ok" and "Cancel". > > > I want to have the user to click on some link inside the dialog to be > > able to trigger the "Ok" button's submit function. Any suggestion to > > use inherent jquery dialog methods to do that instead of accessing the > > DOM of the button directly? > > > Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery UI" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-ui?hl=en -~----------~----~----~----~------~----~------~--~---
