如何在HTML中创建可编辑的下拉列表? [英] How can I create an editable dropdownlist in HTML?

查看:379
本文介绍了如何在HTML中创建可编辑的下拉列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个带有下拉列表的文本字段,让用户选择一些预定义的值。用户还应能够键入新值或从下拉列表中选择预定义的值。我知道我可以使用两个小部件,但在我的应用程序,它会更符合人机工程学,如果它统一在一个小部件。

I'd like to create a text field with a dropdown list that lets the user choose some predefined values. The user should also be able to type a new value or select a predefined one from a dropdown list. I know that I can use two widgets for that but in my app it would be more ergonomnic if it was unified in a one widget.

有一个标准的小部件或做我必须使用第三方javascript吗?

Is there a standard widget or do I have to use a third party javascript?

如何使用浏览器可移植性?

How about browser portability?

推荐答案

最好的方法是使用第三方库。

The best way to do this is probably to use a third party library.

这里有一个实现你在 jQuery UI dojo 。 jQuery是更受欢迎的,但dojo允许你在HTML中声明性地定义小部件,这听起来更像你在寻找。

There's an implementation of what you're looking for in jQuery UI and in dojo. jQuery is more popular, but dojo allows you to declaratively define widgets in HTML, which sounds more like what you're looking for.

您使用哪一个将取决于您的风格,但两者都是为跨浏览器工作开发的,并且两者都会比复制和粘贴代码更新更频繁。

Which one you use will depend on your style, but both are developed for cross browser work, and both will be updated more often than copy and paste code.

这篇关于如何在HTML中创建可编辑的下拉列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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