javascript - 是否可以使用具有统一(jquery 插件)的不同大小(宽度)的选择框?

标签 javascript jquery select width uniform

我想使用具有多个宽度的多个选择框和 uniform 。问题是我什么时候做

$('#small').uniform({selectClass:'smallSelect'});

$('#big').uniform({selectClass:'bigSelect'});

<select id="small">
<option>test</option>
</select>

<select id="big">
<option>test2</option>
</select>

只有第一个被应用,即 bigSelect 被忽略。

最佳答案

您可以通过定位直接生成的跨度来更改每个选择元素的宽度。该代码创建一个 div 包装器,其唯一 ID 为 uniform-yourid 和具有当前选定选项的子 span 元素。以下是您指定的 id 的 css,您可以添加。

<style type="text/css">
#uniform-small span
{
    width:100px;
    text-align:center;
}
#uniform-big span
{
    width:200px;
    text-align:center;
}
</style>

关于javascript - 是否可以使用具有统一(jquery 插件)的不同大小(宽度)的选择框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8677143/

相关文章:

javascript - 为什么空格出现在我的字符串中?

javascript - 使用reduce格式化对象数组?

javascript - 在环回中保存多个模型

javascript - 在 png 图像上添加 div(或其他东西)

javascript - 在 jQuery 中追加

python - 如何使用 selenium 和 python 从下拉列表中获取值列表

c# - $select 和 $expand 中断 ODataQueryOptions——如何修复?

javascript - jQuery 滑动限制

jquery - 第一次加载页面时显示加载图像

mysql - MySQL 中查找换行符和回车符 (\r\n)