Google's new predictive text predicts the search "as you type" in the box by showing the next characters in light gray font. Does anyone know of any code that does this? I am aware of the typical suggest drop down menus but I am looking for example code that does everything in the search box - without auto suggest dropdown menu.
Google's new predictive text predicts the search "as you type" in the box by showing the next characters in light gray font. Does anyone know of any code that does this? I am aware of the typical suggest drop down menus but I am looking for example code that does everything in the search box - without auto suggest dropdown menu.
Share Improve this question edited May 2, 2011 at 8:18 John 30.6k18 gold badges93 silver badges133 bronze badges asked Feb 9, 2011 at 17:57 AndrewAndrew 1672 gold badges4 silver badges12 bronze badges2 Answers
Reset to default 3i found one similar script here which suggest words like google when user type search query
https://sourceforge/projects/searchpuppy/files/
I'm not sure if there are any that exists, but the logic to build one seems simple enough.
It seems to me that the prediction is always the first item in the autoplete list. The prediction is displayed by having two text inputs with transparent backgrounds, one layered underneath the other. The bottom input will contain the prediction (silver text); The top input is where the user types.
As the user types, the autoplete finds a list of suggestions. Take the first suggestion and populate the prediction input with it.
Bind an onKeyPress event to the user-input box and watch for the user to press the right arrow key. If user presses it, populate the user-input box with the value of the prediction box.