Mixing a textfield input with a select input in html
My employer has asked me how to mix the functionality of a textfield input with a select input, "kinda like gmail does when you start typing the address of someone you've already written to, it allows you to choose the person and also to keep writing if it isn't in the database".
How is开发者_运维问答 this done? I imagine there's a javascript/jquery library to implement this.
Yes, there's a whole lot of such plugins. These are probably two most popular (most often asked on SO) and customizable:
http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ (demo here)
http://jqueryui.com/demos/autocomplete
It's called autosuggest or autocomplete. As you're typing, the value of the input is sent via ajax to a server side script (php, for example), which searches a database for a matching item. It then returns the items, and jquery displays them under the input.
There are a bunch of example / tutorials. I'll try to find a good one.
The keyword you are searching for is "autocomplete". There are many jQuery plugins to do that.
Here is one: http://www.pengoworks.com/workshop/jquery/autocomplete.htm
精彩评论