简体   繁体   中英

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?

尝试传递一个true参数以强制刷新。

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

删除data-native-menu =“ false”即可修复该问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM