2016-04-29 14:31:09 +02:00
|
|
|
# Autocomplete for Textarea
|
2016-04-15 02:02:54 +02:00
|
|
|
|
|
|
|
[](http://badge.fury.io/js/jquery-textcomplete)
|
|
|
|
[](http://badge.fury.io/bo/jquery-textcomplete)
|
|
|
|
[](https://github.com/igrigorik/ga-beacon)
|
|
|
|
|
|
|
|
Introduces autocompleting power to textareas, like a GitHub comment form has.
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
[Demo](http://yuku-t.com/jquery-textcomplete/).
|
|
|
|
|
2016-04-29 14:31:09 +02:00
|
|
|
## Synopsis
|
2016-04-15 02:02:54 +02:00
|
|
|
|
|
|
|
```js
|
|
|
|
$('textarea').textcomplete([{
|
|
|
|
match: /(^|\b)(\w{2,})$/,
|
|
|
|
search: function (term, callback) {
|
|
|
|
var words = ['google', 'facebook', 'github', 'microsoft', 'yahoo'];
|
|
|
|
callback($.map(words, function (word) {
|
|
|
|
return word.indexOf(term) === 0 ? word : null;
|
|
|
|
}));
|
|
|
|
},
|
|
|
|
replace: function (word) {
|
|
|
|
return word + ' ';
|
|
|
|
}
|
|
|
|
}]);
|
|
|
|
```
|
|
|
|
|
2016-04-29 14:31:09 +02:00
|
|
|
## Dependencies
|
2016-04-15 02:02:54 +02:00
|
|
|
|
|
|
|
- jQuery (>= 1.7.0) OR Zepto (>= 1.0)
|
|
|
|
|
2016-04-29 14:31:09 +02:00
|
|
|
## Documents
|
2016-04-15 02:02:54 +02:00
|
|
|
|
|
|
|
See [doc](https://github.com/yuku-t/jquery-textcomplete/tree/master/doc) dir.
|
|
|
|
|
2016-04-29 14:31:09 +02:00
|
|
|
## License
|
2016-04-15 02:02:54 +02:00
|
|
|
|
|
|
|
Licensed under the MIT License.
|
|
|
|
|
2016-04-29 14:31:09 +02:00
|
|
|
## Contributors
|
2016-04-15 02:02:54 +02:00
|
|
|
|
|
|
|
Patches and code improvements were contributed by:
|
|
|
|
|
|
|
|
https://github.com/yuku-t/jquery-textcomplete/graphs/contributors
|