I have implemented the autocomplete in a textbox.
Code:
//AutoComplete the textbox having userSearch class.
function AutoComplete() {
//Autocomplete added to the textbox.
$('.userSearch').autocomplete({
source: function (request, response) {
$.ajax({
url: "CTC.aspx/GetMemberName",
data: "{ 'prefixText': '" + request.term + "' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
success: function (data) {
response(data.d);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert('Error occured while autocomplete');
}
});
},
minLength: 1,
change: function (event, ui) { SaveData($(this).attr('id')); }
});
}
It’s working fine.
But I want to restrict the user so that he have to select a option from suggested list.
So that at last don’t need a validation function that inserted data in correct or not.
Please Help
Is there any way do bound the user to select from the suggested list only??
Thanks in advance
Try this