使用 JavaScript 的可编辑和自动完成组合框

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7711299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 01:02:03  来源:igfitidea点击:

Editable and autocomplete combo box with JavaScript

javascriptcomboboxautocomplete

提问by Antonio F.

I need to make a combo box in my form to be editable and capable to search the input text through the values of the combo box (like autocomplete way).

我需要在我的表单中创建一个组合框以使其可编辑并能够通过组合框的值搜索输入文本(如自动完成方式)。

What's the simplest way to obtain this?

获得它的最简单方法是什么?

回答by Xavi López

If you aren't already using any framework that provides this component (i.e. YUI), this component might be useful to you: dhtmlxCombo

如果您尚未使用任何提供此组件的框架(即 YUI),此组件可能对您有用:dhtmlxCombo

回答by the_drow

You can take a look at Dojo's ComboBox.
It has all the features you require and more.

您可以查看Dojo 的 ComboBox
它具有您需要的所有功能以及更多功能。

回答by texnic

I am searching for it myself. One of the solutions I've found is jQuery UI's autocomplete. Seems to be very flexible and well documented. See http://jqueryui.com/autocomplete/#comboboxfor example.

我自己也在寻找。我找到的解决方案之一是jQuery UI 的 autocomplete。似乎非常灵活并且有据可查。例如,请参见http://jqueryui.com/autocomplete/#combobox