我有一个文本框的ID是其他,我想填充此文本框的值到下拉列表这是jquery我用来填充...但这是行不通的..我正在与jQuery的移动..这个脚本正常工作正常的jQuery,但只要我与jQuery的移动工作,它不起作用...任何建议将不胜感激... !!我想这样做: - http://viralpatel.net/blogs/demo/dynamic-combobox-listbox-dropdown-in-javascript.html使用jQuery的手机从文本框填充下拉列表
<script>
function addCombo() {
var optName = $("#other").attr("value");
$('#category').append("<option value='"+ optName + "'>" + optName + "</option>");
$("#other").attr("value", "");
$('#category').selectmenu('refresh', true);
}
</script>
这是下拉列表中的代码
<td>Category</td>
<td><select class="size" id="category" name="category" width="30px">
<option width="30px" value="" selected="selected" >Select</option>
<option value="food">Food</option>
<option value="rent">Rent</option>
<option value="gas">Gas</option>
<option value="enter">Entertainment</option>
<option value="grocery">Grocery</option>
<option value="general">General</option>
<option value="other">Other</option></select></td>
</tr>
<tr>
<td>Other</td>
<td><input type="text" id="other" name="other"/></td>
<td><input type="button" data-role="button" value="Add" onclick="addCombo()"></td>
</tr>
@mc_fish非常感谢...你做了我的一天...真的很感激:)...你可以简单说出你的代码...所以我可以正确理解.. !! – ferhan 2011-04-01 20:46:09
移动图书馆改编了一些元素,以便用户友好!我做了什么?只是添加到ul#-menu(即jquery创建的)li像其他人一样......可能有一个bug,你应该追加到“新”元素#-menu和.custom_values – 2011-04-01 20:50:41
@mc_fish代码是工作正常..假设我们将下载列表添加到hello中,然后我们打开下拉列表来查看hello,然后hello在那里,但是我们无法选择hello .. !!有什么建议么?? – ferhan 2011-04-01 22:05:15