We use jQuery UI autocomplete, and I am having problems clearing the text field containing the search query after the query is completed. Here is our jQuery code:
$(document).ready(function () { $("form#search input#term").autocomplete({ source: '<%= Url.Action("Display", "Search") %>', delay: 200, minLength: 3, parse: function (data) { var array = new Array(); for (var i = 0; i < data.length; i++) { array[array.length] = { data: data[i], value: data[i], result: data[i].link }; } return array; }, select: function (event, ui) { window.location.href = ui.item.value; $(this).val() = ""; return false; } }); });
This code works fine in Firefox, but IE 8 throws an exception and gives a dialog asking if I want to use IE Script Debugger. I saw this post: Clear field field after selection for jQuery UI Autocomplete autocomplete , which says that the solution to the problem is to return false from the jQuery select function, but it didn Help. Anyone have any suggestions on how to fix this?
jquery jquery-ui autocomplete
Russ Clark
source share