According to the documentation at http://docs.jquery.com/UI/Menu#event-select, the following should work when a (click?) Item is selected, but it doesnβt do anything. Did I miss something?
<!DOCTYPE html> <html> <head> <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <link href="http://view.jqueryui.com/menu/themes/base/jquery.ui.menu.css" rel="stylesheet" type="text/css"/> <script src="http://view.jqueryui.com/menu/ui/jquery.ui.menu.js"></script> <script> $(document).ready(function() { $("ul").menu({ select: function(event, ui){ alert('selected'); } }); }); </script> </head> <body style="font-size:62.5%;"> <ul> <li><a href="#">Aberdeen</a></li> <li><a href="#">Ada</a></li> <li><a href="#">Adamsville</a></li> <li><a href="#">Addyston</a></li> <li><a href="#">Adelphi</a></li> </ul> </body> </html>
try changing select to selected
select
selected
$("ul").menu({ selected : function(){ alert("Selected"); } });
EDIT: current version of jquery ui uses 'select' not 'selected' e.g.
$("ul").menu({ select : function(){ alert("Selected"); } });
Source: https://habr.com/ru/post/1414793/More articles:How to rotate, translate and scale a control object around a specific point in WPF - rotationHow to include a hamlet file inside another using widgetFile? - haskellJavascript / HTML5 using an image to fill the canvas - javascriptHow to hide the points displayed on the chart graph? - jqueryGoogle oauth2 authorization in iframe / popup - oauth-2.0implementation of the Paxos algorithm - implementationHow to maintain speed with the server? - javaC ++ Iterator Methods for the Domain - c ++Is it possible to change the default "Term" value in the "jquery UI autocomplete" function? - javascriptGetting FileNotFoundException, even if the file exists and is spelled correctly - javaAll Articles