Click here to Skip to main content
15,795,793 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how can i use validate string before showing suggestion. And if string contain invalid string then it will show an error message like:
No result found, please check your spelling and try again.

What I have tried:

I am using jquery autosuggestion. My code is:


source: function(request, response) {
url: "autocomp3.asp",
dataType: "json",
data: {
term : request.term,
param : paramName,
con : con,
ver : lang
//country_id : $("#country_id").val()
success: function(data) {

$.each(data, function(i) {
//outputdata[i] = data[i].value;
outputdata = data;
//alert (data[i]);
if (data == "")
$("#loc").html("No result found, please check your spelling and try again.");
$("#disBtn").css("display", "none");
$("#disBtn").css("display", "block");
search: function () {
response: function (event, ui) {

len = ui.content.length;
minLength: 1,
delay: 300,
select: function (event, ui) {

//$("#txtAllowSearch").val(ui.item.label); // display the selected text
$("#"+hiddenIdField+"").val(; // save selected id to hidden input
Updated 1-Sep-16 3:09am

1 solution

Look at the supported events in the documentation (especially "search")

Autocomplete Widget | jQuery UI API Documentation[^]

If you need help implementing one google and you'll find source code.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900