JQuery Mobile by default will not update the selected attribute in response to user input. You can save the selected values ββin synchronization with the attributes with the following code.
$(function () { $('select').on('change', function (evt) { var options = $(evt.target).children('option'), current; for (var i = 0; i < options.length; i++) { current = options[i]; if (current.selected === true && !current.hasAttribute('selected')) { options[i].setAttribute('selected', ''); } if (current.selected === false && current.hasAttribute('selected')) { options[i].removeAttribute('selected'); } } }); });
Remember that this will work for all selectmenu widgets that you already have in the DOM. If you add one program code, you also need to add an event handler to this widget.
source share