andandandand
andandandand

Reputation: 22270

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.

Upvotes: 0

Views: 1222

Answers (3)

Raphael Jolivet
Raphael Jolivet

Reputation: 4040

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

Upvotes: 1

Nikita Rybak
Nikita Rybak

Reputation: 68016

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

Upvotes: 1

hookedonwinter
hookedonwinter

Reputation: 12666

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.

Upvotes: 1

Related Questions