Jquery. autocomplete modification Enables automatic filling of up and down keys on the keyboard

Source: Internet
Author: User
You can use the keyboard to move up or down to obtain the values in the Lenovo menu as needed, just like the googlebaidu query function. I have not found any plug-ins that can implement this function for a long time on the Internet. Instead, I can only change the code by myself. Find the KEYDOWN and KEYUP codes in js and execute the following code: cas needs to move up and down through the keyboard as needed to get the values in the Lenovo menu, just like google baidu's query function. I have not found any plug-ins that can implement this function for a long time on the Internet. Instead, I can only change the code by myself. Find the KEY in js. DOWN and KEY. run the following code: case KEY. DOWN: event. preventDefault (); if (select. visible () {select. next ();} else {onChange (0, true);} break; in select. next (); then add var selected = select. selected (); var v = selected. result; $ input. val (v); in this way, when the upper and lower keys are added, the corresponding values in the input box are displayed, but the cursor on the Lenovo keyboard is gone. Select. next (); Code definition next: function () {moveSelect (1) ;}, Add a similar method stay: function () {moveSelect (1 );}, then case KEY. DOWN: event. preventDefault (); if (select. visible () {select. next (); var selected = select. selected (); var v = selected. result; $ input. val (v); select. stay ();} else {onChange (0, true);} break. ============================================ Thank you very much for the original author, add a similar method stay: function () {moveSelect (1) ;}, and then click the upper and lower keys to move across rows. Therefore, change to: stay: function () {moveSelect (0 );},

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.