Is it possible to disable a list element in an autocomplete, so it is not chooseable (and greyed out)?
I have this code, taken from the jQuery UI example page:
HTML:
<input id="tags" />
jQuery:
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$( "#tags" ).autocomplete({
source: availableTags
});
});
As an example - is it possible to disable the last element if there are more than 3 items in the list?
In my real code, I have an AJAX request but I do not want to show more than 20 results in the autocomplete box, so if there are more than this, it should show something like "please narrow down your search" and disable the last element, so it is not chooseable (but only the last element should be disabled).
The above code is here with a Fiddle demo, http://jsfiddle.net/m6zvf/