I am looking for help in my code that allows an autocomplete, only within a specified data array. So only data within the auto complete array is allowed to be entered. Not sure where to do that .Here is my code. Can anyone suggest ??
$(document).ready(function () {
var data = ["ActionScript","AppleScript","Asp","BASIC","C","C++","iran","Scheme"];
$("#autocomplete").autocomplete(data);
});
$('input#autocomplete').result(function (event, data, formatted) {
$("#result").html(!data ? "No match found!" : "Selected: " + formatted);
}).keyup(function () {
$(this).search();
$(this).css("background-color","#D6D6FF");
});
} catch (e) { }
});
Try the
mustMatchoption (docs):Example: http://jsfiddle.net/prCsm/
As a side note, this plugin has been deprecated in favor of the jQueryUI version.