简体   繁体   English

使用JavaScript和jQuery使用强制建议机制(ASP.NET MVC项目)

[英]Using a forced suggestion mechanism using JavaScript and jQuery (ASP.NET MVC project)

Yesterday I discovered that jQuery is really powerful and can do amazing things with only a few (sometimes just one) line of code, amazing! 昨天我发现jQuery非常强大,并且仅用几行(有时只有一行)代码就可以完成令人惊奇的事情! I did some animating which went really well! 我做了一些动画,效果非常好!

So I was wondering if the following is also possible/ simple to implement with jQuery (if not, please tell me what could do this): 所以我想知道以下是否也可能/易于使用jQuery实现(如果没有,请告诉我该怎么做):

Basically I want a suggestion mechanism for the webapplication we are creating. 基本上,我想要一个针对正在创建的Web应用程序的建议机制。 We are doing this using ASP.NET MVC 4. By suggestion mechanism I mean the user gets presented with a textfield, he can start typing and based on his typing topics (I have a model class Topic with a few properties) get suggested. 我们正在使用ASP.NET MVC 4进行此操作。通过建议机制,我的意思是向用户展示了一个文本字段,他可以开始键入,并根据他的键入主题(我有一个带有一些属性的模型类Topic)得到建议。 The user can ONLY choose out of those topics, they can't define any by themself. 用户只能从这些主题中选择,而不能自己定义。 So I would like to generate a list based on the input (with each key tap). 所以我想根据输入(每次击键)生成一个列表。 If they click on an item, it gets added to the box and they can choose other topics if they would want to. 如果他们单击某个项目,则会将其添加到框中,并且他们可以根据需要选择其他主题。

I do realize that this is probably rather difficult to implement, but it would be great if I could find a tutorial or example. 我确实意识到这可能很难实现,但是如果我能找到一个教程或示例,那就太好了。 Preferable with JavaScript or jQuery, but if that's not possible anything will do really! 对于JavaScript或jQuery来说更可取,但是如果不可能的话,任何事情都可以做到!

If my explanation is not clear enough: I mean something similar to the StackOverflow suggestion mechanism for tags. 如果我的解释不够清楚:我的意思类似于标记的StackOverflow建议机制。

如果您想要提示性的文本字段,请搜索html5数据列表数据列表另请参阅JqueryUI自动完成。但是,如果选项不是太多,我会选择菜单而不是文本字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM