US Zip Code, auto format in mvc!

Total Post:104

 3560  View(s)
Rate this:

Hi Expert!

I have one textbox in my MVC 4 project. In this textbox user entered zip code of US format. I want to auto set US format zip code during entered or after leave the textbox.

US format zip code as following


Please help me!

Thanks in advance!

  1. Post:604

    Re: US Zip Code, auto format in mvc!

    Hi Marcel!

    You could try following line of code

    <script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.maskedinput.js" type="text/javascript"></script>
    <script type="text/javascript">
        jQuery(function ($) {

    @Html.TextBox("zip", null)

    "jquery-1.7.1.min.js" provided by MVC application
    "jquery.maskedinput.js" you can download from following link


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.