【发布时间】:2014-06-25 22:05:18
【问题描述】:
我似乎无法让我的 jQuery Mobile 样式应用于我的动态填充选择。我尝试过添加主题、手动添加样式、刷新、$('.ui-page-active').trigger('create'); 等,但没有成功。选择:
<select id="CandidatesListBox" data-placeholder="true" onchange="myMethod()" style="width: 100%" aria-haspopup="true" class="candidatesList" data-theme="c" ></select>
填充它:
var geocodeOption = document.createElement('option');
//fill option
if (_isMobile) {
$('#' + geocodesList.id).append(geocodeOption);
$('select#CandidatesListBox').selectmenu();
$('select#CandidatesListBox').selectmenu('refresh', true);
}
选择下拉菜单本身具有正确的样式,但没有其他内容。如果我添加
geocodeOption.className = geocodeOption.className + ' ui-btn'; 选择看起来就像一个选择和一个按钮,而且选项再次包含没有样式。
我还尝试阅读 jQuery 表单 link 1 和 link 2,但没有成功。我正在使用 jQuery Mobile 1.4.2。
【问题讨论】:
-
创建一个小提琴并展示您是如何动态创建的。
-
这实际上不是问题。问题是我在 Google Canary 中进行测试,它不会生成与 android 平板电脑相同格式的选项(它会像 Chrome 那样生成它们)。在android上,选项正确生成
标签: css jquery-mobile