手动键入“选择”中的值/下拉HTML列表? [英] Manually type in a value in a "Select" / Drop-down HTML list?

查看:153
本文介绍了手动键入“选择”中的值/下拉HTML列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows窗体应用程序中,下拉列表还为用户提供了在同一个字段中输入替代值的选项(假设开发人员已经在控件上启用了此选项。)

In a Windows Forms application, a drop-down selector list also gives the user the option of typing an alternate value into that same field (assuming the developer has left this option enabled on the control.)

在HTML中如何实现?它似乎只能从列表中选择值。

How does one accomplish this in HTML? It appears as if it is only possible to select values from the list.

如果不可能用直接的HTML来做到这一点,有没有办法用Javascript ?

If it's not possible to do this with straight HTML, is there a way to do this with Javascript?

推荐答案

现在可以使用HTML5完成

It can be done now with HTML5

发布到这里 HTML选择表单与选项输入自定义值

<input type="text" list="cars" />
<datalist id="cars">
  <option>Volvo</option>
  <option>Saab</option>
  <option>Mercedes</option>
  <option>Audi</option>
</datalist>

这篇关于手动键入“选择”中的值/下拉HTML列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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