Maybe it would help if someone can confirm for me whether I understand the method syntax correctly. Here's the example from the API:
$( ".selector" ).menu( "focus" , null , menu.find( ".ui-menu-item:last" ) );
|
If I understand correctly, I should replace ".selector" with the list container I wish to render as a ui-menu, and then replace ".ui-menu-item:last" with a selector that will match the ID of the list item I want to focus. Correct?
The error message seems to indicate that this entity
menu on which the find() method is invoked is a div element, though the selector I'm using returns a ul. So maybe I need a selector for
menu? I tried the following:
$( "#menu>ul" ).menu( "focus", null, $( "#menu>ul" ).find( "#focus_target" ) );
... which then gives me the following error:
Uncaught Error: cannot call methods on menu prior to initialization; attempted to call method 'focus' Fair enough. Can't invoke an object's methods before it is created. So I tried creating the menu in one step and calling the focus() method in another:
$( "#menu>ul" ).menu({
position: { my: "left top", at: "right-5 top+5" }
});
$( "#menu>ul" ).focus("#focus_target");
... which doesn't throw any errors, but also doesn't appear to do anything.
What am I missing?