Click here to Skip to main content
15,032,967 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i use jquey autocomplete for autosuggestion.I use min_length:3 because i want that when user type 3 characters then it show the sugestion.But it is not working properly.Sometimes it show suggestion after typing 1 character.My code is given:



JavaScript
$("#state").autocomplete({
//		var str : $("#state").val(),
		source: function(request, response) {
            $.ajax({
                url: "autocomp3.asp",
                dataType: "json",
                data: {
                    term : request.term,
                    tbl_name : "UserAccounts",
					ID : "accID",
					Value : "accFirstName"
					//country_id : $("#country_id").val()
                },
                success: function(data) {
                    response(data);
                }
            });
        },
        min_length: 3,
        delay: 300
    });



Help is needed.

What I have tried:

$(function() {




$("#state").autocomplete({
// var str : $("#state").val(),
source: function(request, response) {
$.ajax({
url: "autocomp3.asp",
dataType: "json",
data: {
term : request.term,
tbl_name : "UserAccounts",
ID : "accID",
Value : "accFirstName"
//country_id : $("#country_id").val()
},
success: function(data) {
response(data);
}
});
},
min_length: 3,
delay: 300
});


});
Posted
Updated 25-Apr-16 2:10am

Consult the documentation for the proper usage of minLengh

Autocomplete Widget | jQuery UI API Documentation[^]
   
Syntax error: min_length:

JavaScript
minLength: 3


refer: AutoComplete min length[^]
   

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