I have a plain select element, which I’m setting to the first option.
<select name="hersteller_typSEL" id="hersteller_typSEL" data-theme="c">
<option value="aktiv" selected="selected">#tx_sellerlist_available_sellers#</option>
<option value="alle">#tx_sellerlist_all_sellers#</option>
</select>
First time I load the page, this sometimes works…
If I then select the 2nd option and refresh the page by clicking the (Firefox) refresh button, I’m always getting the 2nd option as inital value, which is driving me insane… because the selected=”selected” is correct on the first option, but JQM puts the test of the 2nd option in ui-btn-text
Question:
How can I set a selected option in JQM when the page loads afresh? (I’m not talking about going back/forth in the DOM, I’m clicking refresh in the browser (Firefox) and I’m still getting the wrong value).
According to the docs, jquerymobile.com/demos/1.0a4.1/docs/forms/forms-selects.html, you need to call
refreshon the select element after updating it in code.You should also do this on page load.