3

I have a field like:

<div class="editor-field">
      @Html.TextBoxFor(model => model.DivNo)
</div>

I am using Autocomplete and maskedinput jquery libraries to format my field and auto complete suggestion from database.

$("#DivNo").mask("999 9999");

$("#DivNo").unmask().autocomplete({
    source: '@Url.Action("actionname","ControllerName")',
    minLength: 1
});

Now when i enter values into my textbox field, it is not showing autocomplete values as dropdown as i type along. But the mask is working and displaying values in 999 9999 format.Please suggest.

Thanks

Tushar Gupta - curioustushar
  • 58,085
  • 24
  • 103
  • 107
user1882705
  • 1,081
  • 4
  • 15
  • 43

1 Answers1

0

I had similar problem and found solution so sharing it even after 4 years.. Your input masking is as follows :

$("#DivNo").mask("999 9999");

So your for example if you type 55 in your input due to masking the input has value as 55_ ____.

It adds underscore ( _ ) to the input value instead of 55 which your autocomplete is expecting.

And obviously your autocomplete will not contain any item which would match the above, hence your autocomplete does not give any suggestion.

Vignesh Pandi
  • 349
  • 1
  • 4
  • 15