I am using jquery and looking for a autocomplete that will support the mustMatch option (where the user must enter an exists item name) -> this is not a problem since there are several autocompletes that do so.
The problem is that I need the autocomplete will test the entered value.
For example:
Do you know such autocomplete plugin? Or maybe do you know how can I modify an exists plugin to do so?
jQueryUI's autocomplete can do this along with Scott González' autoSelect plugin , combined with the change
event on the widget. If you include the plugin, all you should need is:
$("#auto").autocomplete({
source: ['England', 'Germany', 'Denmark', 'Sweden', 'France', 'Greece', 'Italy'],
change: function (event, ui) {
if (!ui.item) {
this.value = '';
}
}
});
Example: http://jsfiddle.net/qb59C/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.