如何在选择标签中添加虚线作为选项?
我想创建一个类似于 Twitter 设置中的时区选择的选择标签。问题是我不知道如何在美国时区和世界其他地区之间建立虚线。所以我的问题是如何在 HTML 选择标签中将虚线作为选项(无法选择)?
答案最好是用 javascript 写的
I want to make a select tag similar to the the time zone selection you have in Twitter Settings. The thing is I don't know how to make the dotted line between american time zones and rest of the world. So my question is how do I do a dotted line as an option(which can't be selected) in a HTML select tag?
The answer should be preferably be in javascript
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果你检查他们的来源,你会发现他们只是对该行有一个禁用选项:
If you inspect their source, you will see they just have a disabled option for that line:
没有可以添加的“分隔符”。通常的解决方案是添加一个带有文本
-----------------
且没有任何值的option
。添加验证规则,确保为选择器选择一个值。
There is no "separator" that you can add. The usual solution is to add an
option
with the text-----------------
and no value.Add a validation rule which makes sure that a value is selected for the selector.