After changing a menu from a regular select to a jQuery selectmenu, I can no longer select options in it programatically. Is there a way to do this?
The code to select is (assuming ListId is the actual Id of the list)
$('#ListId').val(value);
The plugin is activited like this:
$("#ListId").selectmenu({ style: "dropdown", width:140 });
Is there a way to select an item in the select menu? Calling the same .val(value) function just selects the value in the hidden original select list, not the nicely styled jQuery selectmenu.
Assuming that you have already done this part once before:
$("#ListId").selectmenu({ style: "dropdown", width:140 });
I found this works:
$('#ListId').val(value);
$('#ListId').selectmenu("refresh");
This causes the the stylized drop down to show the correct value.
$('#ListId').selectmenu("value", value);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With