最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Grails: How to make a g:textfield autocomplete? - Stack Overflow

programmeradmin8浏览0评论

I have a g:textfield, and I want to write something and then show me all the options possible that start with the same letter. I understand that is called AutoComplete.

Maybe using jQuery or JavaScript?? Any ideas??

Thanks in advance!

I have a g:textfield, and I want to write something and then show me all the options possible that start with the same letter. I understand that is called AutoComplete.

Maybe using jQuery or JavaScript?? Any ideas??

Thanks in advance!

Share Improve this question asked Oct 8, 2010 at 17:19 randomizertechrandomizertech 2,32915 gold badges50 silver badges85 bronze badges 1
  • You can see answer here stackoverflow./questions/10433858/… – Karen Commented May 6, 2012 at 11:09
Add a ment  | 

2 Answers 2

Reset to default 5

How about using an existing plugin:

  • jQuery plugin: Autoplete
  • Demo

If have problem to use it with <g:textfield>, Here is a thread that may help you to implement.

say you are going to autoplete on a 'thing' field

  1. you need an autoplete widget, jquery has one, that you use for the thing field
  2. you need a server endpoint that finds 'things' based on what the user types in. this endpoint will return json.

thats really it. as you mentioned, the widget will use ajax to query the server when the user types in the field, and it will use the response to draw a div that contains possible pletions.

发布评论

评论列表(0)

  1. 暂无评论