Sorry if my question is too simple, but I can't figure it out from the jQuery UI documentation.
How can I determine which option was clicked within a menu? I tried something like this but it didn't work:
var menu = $('#menu');
menu.menu({
select: function(event, ui) {
alert(ui.type);
}
});
What you are missing is the fact that 'ui' is a jQuery object that represents the item you clicked.
so to get the text out of that item you should be using:
var menu = $('#menu');
$(document).ready(function(){
menu.menu({
select: function(event, ui) {
alert(ui.item.text());
}
});
});
That will give you the text of the item.