create custom mascara

2

How do I create a custom skin for a given field? The mask will be in the following format:

asked by anonymous 10.12.2015 / 20:43

1 answer

4

Use the NuGet package jQuery.MaskedInput .

In View :

@section scripts {
    <script>
        $("#OrdemBancaria").mask("9999OB99999");
    </script>
}

I usually use the Bundle like this:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/Scripts/jquery-{version}.js",
                    // Alguns JS aqui
                    "~/Scripts/jquery.maskedinput.js",
                    // Mais alguns aqui
                    ));
    
10.12.2015 / 20:50