Ian Vink
Ian Vink

Reputation: 68750

jQuery Mobile: Adding to a SELECT in Code works only on Desktop browsers?

On desktop browsers (FF,IE,CR) I am able to add to a Select with this jQuery:

        var output = [];
        for (var i = 1; i < 32; i++) {
            output.push("<option value='" + i + "'>" + i + "</option>");
        }
        $("#cboDay").append(output.join(' ')).selectmenu('refresh');

However, it does not work on iPhones or Androids.

For reference here's the Select:

<select name="cboDay" id="cboDay" data-native-menu="false"></select>

Any ideas?

Upvotes: 2

Views: 105

Answers (2)

Ian Vink
Ian Vink

Reputation: 68750

Removing data-native-menu="false" fixes it.

Upvotes: 0

Sushanth --
Sushanth --

Reputation: 55740

Try passing a true argument to force the refresh..

$("#cboDay").append(output.join(' ')).selectmenu('refresh', true);

Upvotes: 1

Related Questions