<link href="http://code.jquery.com/ui/jquery-ui-git.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-git.js"></script>
<script src="http://code.jquery.com/ui/jquery-ui-git.js"></script>
<script src="https://rawgithub.com/robotdan/jquery-ui/bug_9695/ui/jquery.ui.autocomplete.js"></script>
<pre>
Recreate:
1. Start typing the letter a
2. Key down to any of the disabled items
3. Press [ENTER] or [TAB]
4. Ensure the menu is not dismissed and you don't receive an alert
5. You may select the enabled item by using [ENTER] or [TAB]
</pre>
<input id="tags">
JavaScript
$( "#tags" ).autocomplete({
select: function (event, ui) {
if ( ui.item.label !== "JavaScript" ) {
alert( "You have selected " + ui.item.label + " but you shouldn't have!" );
}
},
source: [
"Clojure",
"COBOL",
"ColdFusion",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Python",
"Ruby",
"Scala",
"Scheme"
]
}).data( "ui-autocomplete" )._renderItem = function( ul, item ) {
var li = $( "<li>" )
.append( $( "<a>" ).text( item.label ) )
.appendTo( ul );
if ( item.label !== "JavaScript" ) {
li.addClass( "ui-state-disabled" );
}
return li;
};
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.