Mr *_*der 5 javascript jquery select width uniform
我想使用多个宽度均匀的多个选择框.问题就在于我
$('#small').uniform({selectClass:'smallSelect'});
$('#big').uniform({selectClass:'bigSelect'});
<select id="small">
<option>test</option>
</select>
<select id="big">
<option>test2</option>
</select>
Run Code Online (Sandbox Code Playgroud)
只应用第一个,即bigSelect被忽略.
小智 9
您可以通过定位直接生成的跨度来更改每个选择元素的宽度.该代码创建一个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>
Run Code Online (Sandbox Code Playgroud)