I use the "Menu Select" widget to display a list of states on the form:
<select name="state" id="state"> <option value = "">Select State</option> <option value = "Alabama">Alabama</option> <option value= "Alaska">Alaska</option> <option value= "Arizona">Arizona</option> <option value= "California">California</option> <option value= "Colorado">Colorado</option> <option value= "Connecticut">Connecticut</option> </select>
In my script I have
$( "#state" ).selectmenu();
Now I'm trying to send a notification about the value of the selected parameter. So I have this:
$('select').on('change', function (e) { var optionSelected = $("option:selected", this); var valueSelected = this.value; alert(valueSelected); });
The problem is that for some reason this does not work when I use the jQueryUI selectmenu() function
When I delete one line, everything works as usual. As far as I understand, I need to include $( "#state" ).selectmenu(); to use the theme and functionality of the jQuery user interface.
Can anyone enlighten me on what could be the problem. Again, it works fine if I delete this selectmenu line.
Thanks!
javascript jquery jquery-ui jquery-ui-selectmenu
user3785198
source share