Hi Experts,
I want a message if the city is not found in the dropdown list for that I am using textbox and jquery,
here is my code
index.cshtml
@Html.TextBoxFor(i => i.city, new { id = "Myid", @placeholder = "Your City", maxlength = 10, @class = "txt-small-50 ajax-select-cityList alphabetsonly", @required = true })
@Html.ValidationMessageFor(i => i.city)
$(function () {
$('#Myid').city({
// When user type something, onType event will fire.
onType: function (text) {
if (!this.currentResults.items.length) {
$('#cityNot').removeClass('hide');
} else {
$('#cityNot').addClass('hide');
}
}
});
});
$(function () {
$('#Myid').text({
// When user type something, onType event will fire.
onType: function (text) {
if (!this.currentResults.items.length) {
$('#cityNot').removeClass('hide');
} else {
$('#cityNot').addClass('hide');
}
}
});
});
Sachin SinghPosted May 2, 2022, 11:30 AM
Sachin SinghPosted May 2, 2022, 11:43 AM
Guest UserPosted May 2, 2022, 11:34 AM
Guest UserPosted May 2, 2022, 11:28 AM
Sachin SinghPosted May 2, 2022, 10:29 AM
You are not doing anything wrong, you just don't know about the plugin and how does that work.
Please share your autocomplete code.
Search your whole solution/ js file where your autocomplete is initializing.
search ($("Myid").autocomplete) word in your solution using ctrl+f and select the whole solution in the find dropdown of visual studio.
after that share the code.
Guest UserPosted May 2, 2022, 10:11 AM
Sachin SinghPosted May 2, 2022, 8:35 AM
Jignesh KumarPosted May 2, 2022, 5:35 AM