I'm using jqueryui 1.10.4 with a django backend. My code is shown below. Any thoughts on how to fix it? Thanks in advance.
$('#id_legal_block') .bind( "keydown", function( event ) { if ( event.keyCode === $.ui.keyCode.TAB && $( this ).autocomplete( "instance" ).menu.active ) { event.preventDefault(); } }).autocomplete({ minLength:1, source: function(request, response) { $.getJSON('/legalBlockList/', {block_startswith: extractLast(request.term)}, function(data) { response( $.map(data, function(item){ if (item.fields.over !== '') { return { label: item.fields.over + '/' + item.fields.block, value: item.pk }; } else { return { label: item.fields.block, value: item.pk }; } })); }); }, select: function( event, ui ) { var terms = split( this.value ); // remove the current input terms.pop(); // add the selected item terms.push( ui.item.label ); //set the base list to the new list legalBlockList = terms; // add placeholder to get the comma-and-space at the end terms.push( "" ); this.value = terms.join( ", " ); return false; } });