创建输入自动完成功能非常实用的脚本:At.js
jopen
11年前

At.js - 非常实用的脚本用于创建输入自动完成功能 (使用 Emojify 的示例).
$('.atwho-inputor').atwho({ at: "@", data: ["one", "two", "three"], }); 还有一个库叫Typehead来自推ter也实现了同样功能。
特性
- Support IE 7+ for textarea.
- Supports HTML5 contentEditable elements (NOT include IE 8)
- Can listen to any character and not just '@'. Can set up multiple listeners for different characters with different behavior and data
- Listener events can be bound to multiple inputors.
- Format returned data using templates
- Keyboard controls in addition to mouse
TaborEnterkeys select the valueUpandDownnavigate between values (andCtrl-PandCtrl-Nalso)Rightandleftwill re-search the keyword.
- Custom data handlers and template renderers using a group of configurable callbacks
- Supports AMD </ul>