Create auto complete in input?

Asked

Viewed 71 times

0

I want to do an effect of autocomplete in a input, as a prompt, example, I have the following commands in a array php:

ADD 
SUB
SHOW
MUL

I want to make sure that when he starts typing, for example typing "A", display a kind of placeholder completing the command, thus: ToDD, but not adding the "DD" already in the input, just as "placeholder", and if the user presses the key TAB for example there yes it adds the "DD" at the input.

My biggest difficulty is making this placeholder effect on input I have no idea how to do it. I think the rest I can do alone, but the starting point (autocomplete effect) I have no idea how to do, can give a light?

  • Take a look at these examples: http://jsfiddle.net/sgxkj/

  • The example of Gabriel you can do without javascript, only using the datalist tag of Html5 http://www.w3schools.com/tags/tag_datalist.asp

  • Yes yes, I was going to say that kk what I wanted is in the inside of the input even display the first option

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.