0

我正在通过 jquery mobile 添加一个选择输入框,但是输出看起来就像一个普通的、普通的 html 选择框。

演示:jsFiddle

这是我的 JS

$('#admindiv').empty();
$('#admindiv').append('<select name="selectadmin" id="selectadmin"><option value="none">New Admin</option>');
for (var i=0; i< 10; i++) {
    $('#selectadmin').append('<option class="adminoption">'+i+'</option>');
}
$('#admindiv').append('</select>');

它应该是这种格式。我该如何解决?

在此处输入图像描述

4

1 回答 1

1

I believe the jQuery Mobile code that customizes select elements runs at load time, probably before your new elements are created.

Following up with:

$('#admindiv select').selectmenu();

should do it. It works in your Fiddle, at least with just the 1.3.0b1 framework enabled.

于 2013-07-25T01:09:16.893 回答