谷歌Chrome的下拉列表中选择排序似乎是不正确 [英] Google chrome dropdown list options ordering seems to be incorrect

查看:118
本文介绍了谷歌Chrome的下拉列表中选择排序似乎是不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用下面的code在我的形式之一,呈现一个选择框,当我检查,我可以看到在Firefox下code

I am using the following code for rendering a select box in one of my form and when i inspects i can see the following code in Firefox

<select name="make">
    <option value="13501">Jeep</option>
    <option value="26838">Joyner</option>
    <option value="13658">Kia</option>
    <option value="13898">Lada</option>
</select>

但在铬,当我检查表单元素,我可以看到

But in chrome when i inspect the form element i can see

<select name="make">
    <option value="13501">Jeep</option>
    <option value="13658">Kia</option>
    <option value="13898">Lada</option>
    <option value="26838">Joyner</option>
</select>

中的任何一个,请提出一个解决方案?

Any one please suggest a solution for this?

推荐答案

这不是一个真正的好做法,但...

It's not a real good practice but...

如果您添加空间的价值铬不会考虑值的数字,不会按值排序。

If you add a space to the value chrome will not consider value a number and won't sort them by value.

例如:

<select>
  <option value=" 3">Third</option>
  <option value=" 1">First</option>
  <option value=" 2">Second</option>
</select>

好的一面是,你有没有从ID添加,然后删除字母像有人建议的(不记得是否在这个或其他后有类似的问题),你可以很容易修剪,但大部分的时间的空间不理,如果你发布或让那些到另一个文件中,他们将只看到整数值不占空间。

The good side is that you have not to add and then remove alphabetic characters from ID like someone suggested (don't remember if in this or other post with similar question), you could easily trim it but most of the times the space is just ignored and if you post or get those to another file they will simply see the integer value not the space.

这篇关于谷歌Chrome的下拉列表中选择排序似乎是不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆