diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-07-13 11:03:25 -0400 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2011-07-13 11:03:31 -0400 |
commit | 7856b264a297d78762f599611580804b92afd1c0 (patch) | |
tree | 1f2ecbd3e263609127ea4248c12fd1e46d7f0c0d /demos/menubar/default.html | |
parent | 06676f46966d43b6ba169363d751074645c8c303 (diff) | |
download | jquery-ui-7856b264a297d78762f599611580804b92afd1c0.tar.gz jquery-ui-7856b264a297d78762f599611580804b92afd1c0.zip |
Menubar: Trigger select event after running all other methods. Allows the select-handler to destroy the widget without errors.
Diffstat (limited to 'demos/menubar/default.html')
-rw-r--r-- | demos/menubar/default.html | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/demos/menubar/default.html b/demos/menubar/default.html index 6bd67b64a..adee4afc9 100644 --- a/demos/menubar/default.html +++ b/demos/menubar/default.html @@ -13,13 +13,17 @@ <script src="../../ui/jquery.ui.menubar.js"></script> <script> $(function() { + function select(event, ui) { + $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log"); + if (ui.item.text() == 'Quit') { + $(this).menubar('destroy'); + } + } $("#bar1").menubar({ position: { within: $("#demo-frame").add(window).first() }, - select: function(event, ui) { - $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log"); - } + select: select }); $(".menubar-icons").menubar({ @@ -29,9 +33,7 @@ position: { within: $("#demo-frame").add(window).first() }, - select: function(event, ui) { - $("<div/>").text("Selected: " + ui.item.text()).appendTo("#log"); - } + select: select }); }); </script> |