, ask how to implement the effect of typing pinyin or automatically prompt under text. Is there a plugin available? The region is the province of the country three level
Reply content:
, ask how to implement the effect of typing pinyin or automatically prompt under text. Is there a plugin available? The region is the province of the country three level
The simplest way to do this is to first deal with what strings each word can be hit, and which ones to highlight.
Pinyin is very good, network on a large pile of Chinese characters to Pinyin JS.
If you want to be complex, please google a variety of automatic machines, a few words not finished.
As for the library,
http://twitter.github.io/typeahead.js/
http://ichord.github.io/At.js/
......
Use auto complete to find the key words. I don't know if I can support Chinese pinyin.
In fact, the difficulty is not with these plugins ... It's a matter of needing attention when using these plugins.
- The first thing to consider is whether the content that needs to be automatically prompted is dynamically loaded or loaded into the page at once.
- If it is a one-time loading into the page, the amount of data is not large, if large, whether to delay loading
- If dynamic loading requires consideration of how to send AJAX requests, it is not necessary to set a timer on the onchange () event listener (because input Chinese actually input some English conversions. For example, if you enter "You", you actually enter "n" and then "I" and then convert to "you". If you listen directly to the contents of the input box to send an AJAX request, it may send a lot of instant. )
- Second, the dynamic request to load, you need to consider how the background to handle the sending of the asynchronous request, is to query the database or cache, if the database is indexed. If you go to cache, how to design data structure.
The simple approach is to delay asynchronous one-time loading ....
Listening for keyboard events
Ajax Pull Data
Jquery.autocomplete, please give me a praise, thank you, at the same time wish you a happy New Year!