This example describes the JS text box input smart prompt effect code. Share to everyone for your reference. Specifically as follows:
The screenshot of the running effect is as follows:
General ideas:
1. Listen for text box events. Here is the use of the KeyUp event. You can try to use the onchange event. But feel the keyup the effect of the incident better.
2. Access back-end data via Ajax asynchronous method based on input content.
3. Traverse return data to add data to the display area.
4. Add some effect to each piece of data while adding the data, click on one of the data to fill in the text box, and the hint content disappears.
5. Background data should be spliced into JSON format.
The specific code is as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
">
JS text Box input Intelligent effect, for us to enter information to search very practical value, I hope this article for you to learn JavaScript programming help.