JQueryUI selection menu does not start

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> 
+4
source share
1 answer

try changing select to 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"); } }); 
+3
source

Source: https://habr.com/ru/post/1414793/


All Articles