jQuery - Widget Select Menu


The Widget Select Menu function can be used with widgets in JqueryUI.It provides a styleable select element replacement. A simple select menu is as shown below.


Here is the simple syntax to use Select Menu −

$( "#menu" ).selectmenu();


Following is a simple example showing the usage of Select Menu −

<!doctype html>
<html lang="en">
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>jQuery UI Selectmenu - Default functionality</title>
      <link rel = "stylesheet" 
         href = "//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
      <script type = "text/javascript" 
         src = "https://www.tutorialspoint.com/jquery/jquery-3.6.0.js">
      <script type = "text/javascript" 
         src = "https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js">
         $(function() {
            $( "#speed" ).selectmenu();
            $( "#files" ).selectmenu();
            $( "#number" ).selectmenu().selectmenu( "menuWidget" ).addClass( "overflow" );
         fieldset {
            border: 0;
         label {
            display: block;
            margin: 30px 0 0 0;
         select {
            width: 200px;
         .overflow {
            height: 200px;
      <div class = "demo">
         <form action = "#">
               <label for = "speed">Select a speed</label>
               <select name = "speed" id = "speed">
                  <option selected = "selected">Medium</option>
               <label for = "files">Select a file</label>
               <select name = "files" id = "files">
                  <optgroup label = "Scripts">
                     <option value = "jquery">jQuery.js</option>
                     <option value = "jqueryui">ui.jQuery.js</option>
                  <optgroup label = "Other files">
                     <option value = "somefile">Some unknown file</option>
                     <option value = "someotherfile">Some other file with a
                        very long option text</option>
               <label for = "number">Select a number</label>
               <select name = "number" id = "number">
                  <option selected = "selected">2</option>

This will produce following result −

Kickstart Your Career

Get certified by completing the course

Get Started