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
<div class="col-xs-6"> <span class="ui-front"> @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) </span> <span class="fa fa-caret-down"></span> <label id="cityNot" class="hides">City Not Found</label> </div>
$(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'); } } }); });