Autocomplete functionality on a textarea [closed]

You could also (two years later, mind you) try asuggest, it offers word completion inside the textarea after the caret.

A simple example:

var suggests = ["hello", "world"];
$("#text-area1").asuggest(suggests);

This will match things easily, no limits, no minimum character count.

More bells and whistles:

var suggests = ["head", "hello", "heart", "health"];
$("#text-area1").asuggest(suggests, {
    'endingSymbols': ', ',
    'minChunkSize': 3,
    'delimiters': ':',
    'stopSuggestionKeys': [$.asuggestKeys.RETURN]
});

This would require a three (or more) character to start matching, as well as requiring the string to begin with the characater :, place a comma , after each completion, and stop bugging you after you hit the RETURN key.

With some tab-cycling, to be discrete:

var suggests = ["head", "hello", "heart", "health", "horizontal"];
$("#text-area1").asuggest(suggests, {
    'autoComplete': false,
    'cycleOnTab': true
});

This won’t offer up suggestions, but will cycle through the matches when the user hits their TAB key.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)