Hello Team,
I want a city name by writing the one character.
for example :
i have two textbox in my Web Page that is CityTextbox and State Textbox
if i write the word H ,i want the city started from H that is hyderabad,Himachal Pradesh ... and so on which i am not getting.Please kindly help me, how to get it?
I have the number of city and state in SQL Table.
I have the function as follow:
var cityList = [];
var stateList = [];
<pre lang="cs">function setFocusLostEvents() {
$('#txtCity').focusout(function () {
var states = $.grep(cityAndStateList, function (item, index) {
return $('#txtCity').val().toLowerCase() == item.City.toLowerCase()
});
$('#txtState').val('');
if (states != null && states.length > 0) {
$('#txtState').val(states[0].State);
}
});
}</pre>
function bindStateAndCityDropDown() {
$.each(cityAndStateList, function (i, item) {
cityList.push(item.City);
if ($.inArray(item.State, stateList) < 0) {
stateList.push(item.State);
}
});
$("#txtCity").autocomplete({
source: cityList,
select: function (e, i) {
$("#txtCity").val(i.item.val);
},
minLength: 1
});
$("#txtState").autocomplete({
source: stateList,
select: function (e, i) {
$("#txtState").val(i.item.val);
},
minLength: 1
});
}
Where should i modify the code.
Thanks
Harshal Raut