是否有一个Jquery插件来替换select标签,该标签允许用户键入自己的选项? [英] Is there a Jquery plugin to replace the select tag which lets users type in their own option?

查看:119
本文介绍了是否有一个Jquery插件来替换select标签,该标签允许用户键入自己的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个jquery插件来替换html select输入.它的行为应与常规选择相同,但还应包含一个文本框,允许用户输入自己的选项.

I'm looking for a jquery plugin to replace the html select input. It should behave in the same way as the regular select, but also contain a textbox allowing the user to enter in their own option.

例如,假设这是有效的标记:

For example, imagine this were valid markup:

Favorite fruit:
<select>
  <option value="op1"> Apples </option>
  <option value="op2"> Bananas </option>
  <option value="new"> other: <input/> </option>
</select>

推荐答案

您可能会使用jQueryUI的自动完成破解行为类似的东西,例如:

You could probably use jQueryUI's autocomplete to hack something up which behaves similarly, for example:

var fruits = ["apples", "oranges"];
$("input").autocomplete({
    source: fruits,
    minLength: 0
}).autocomplete("search", "");


Select preset from list or type something: <input type="text"/>

在这里玩.

这篇关于是否有一个Jquery插件来替换select标签,该标签允许用户键入自己的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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