更改html中选择项目的大小(宽度) [英] Changing the size (width) of a select item in html
问题描述
我是新的HTML,我正在尝试使用phoneGap和jQuery插件构建一个移动应用程序。我目前正在使用eclipse编程,在我的应用程序,我有一个drop dwon菜单(选择)与几个项目。我试图改变选择项的宽度,但它不工作。这里你可以看到我做了什么来解决这个:
I am new to HTML, and I'm trying to build a mobile app using phoneGap and jQuery plug-in. I am currently programing using eclipse, In my app I have a drop dwon menu (select) with a couple of items in it. I am trying to change the width of the select item, but it doesnt work. here you can see what have i done to solve this:
<label for="select-choice-1" class="select">Choose Expiry Date</label>
<select id="date" name="select-choice-1" id="select-choice-1" style="width:150px">
<option value="">1</option>
<option value="">2</option>
<option value="">3</option>
<option value="">4</option>
</select>
推荐答案
$('#date').css('width', 'new_Value');
来自jQuery Mobile文档:
From jQuery Mobile Documentation:
a select
如果您通过JavaScript操作选择,则必须调用其上的刷新方法来更新视觉样式。下面是一个示例:
If you manipulate a select via JavaScript, you must call the refresh method on it to update the visual styling. Here is an example:
var myselect = $("select#foo");
myselect[0].selectedIndex = 3;
myselect.selectmenu("refresh");
这篇关于更改html中选择项目的大小(宽度)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!