The native HTML select menu is enhanced by the jQuery Mobile framework to make it finger friendly for mobile devices. This recipe shows you how to auto-initialize the Select Menu by setting its control options using JavaScript.
Copy the full code of this recipe from the code/05/select-menu
sources folder. This code can be launched using the URL http://localhost:8080/05/select-menu/main.html
.
In
main.html
, add the following code to create a select menu:<form action='#' method='post'> <div data-role='fieldcontain'> <label for='selectid' class='select'>Sample Select Menu</label> <select name='selectid' id='selectid' multiple data-native-menu='false' data-overlay-theme='e'> <option value='Sample Select Menu' data-placeholder='true'>Sample Select Menu</option> <option value='opt1'>Option 1</option> <option value='disabledopt' disabled>...