GlenS GlenS - 6 months ago 20x
Javascript Question

JQuery Mobile select box not displaying selected option

I hope someone can help I've looked for the answer and tried many options….. I have a HTML5 database and tables that is updated, then the select box is emptied, new select options are created. The problem is the selected option is not displayed. Below is the actual query Mobile code. Thanks

function updateCList() {
db.transaction(function (tx) {
tx.executeSql('SELECT * FROM CourseTable', [], function (tx, results) {
var len = results.rows.length, i;
SelectOption(document.courseData_form.coursemenu, "Course Type", "Course Type")
for (i = 0; i < len; i++){
SelectOption(document.courseData_form.coursemenu, results.rows.item(i).c_type, results.rows.item(i).c_type);
}, null);
$('#coursemenu').selectmenu('refresh', true);


This was my workaround. When I used the empty command the link to the default was broken, this code removes all option but the first.

            function emptyCList() {
                var select = document.getElementById("coursemenu");
                var len = select.options.length;
                for (i = len; i > 0; i--) {
                    select.options[i] = null;