The jQuery plug-in Autocomplete does not support multiple Chinese characters. jqueryautocomplete

Source: Internet
Author: User

The jQuery plug-in Autocomplete does not support multiple Chinese characters. jqueryautocomplete
In front-end web development, when it comes to selection, Autocomplete is a very common plug-in, but this plug-in has some bugs when it comes to Chinese.
This plug-in works well every time a text is entered. When multiple text is entered at a time, it cannot be used for filtering.


This problem is particularly evident on mobile phones. This problem exists even if you use the mobile version of Autocomplete.


Check the source code. The cause is that the event. keyCode is used to filter triggered events. However, because of the special nature of Chinese input, especially on mobile phones, Pinyin is used first and then Chinese characters are selected,
If you select a Chinese character, the keyboard event cannot be triggered, and no event. keyCode exists.
The problem arises.


Modify the source code and add a listener to the input event. This event supports excellent support in chrome browsers and mobile terminals. It can listen to changes in the content of the input box in real time without waiting until the focus is lost, this is different from the onchange event.


Modify as follows:


It is about 156 rows bound to the input event.


.

Bind ("input", function () {onChange (0, true );})




After modification, the problem is solved.

Jquery autocomplete usage Problems

This is too general. First, check whether js reports errors. If no errors are reported, check whether the method is correct.

How does Jquery AutoComplete plug-in work?

... Use cookies!
Generally, AutoComplete is used to input notifications.
!!!

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.