Canadian postal code input mask

Hi friend, I work most with the Canadian clients so most of the time I need Canadian postal code client side validation. I didn’t get any jquery validation for the Canadian postal code, but we can overcome this problem by using input mask of jquery.

You just have to add a jquery file of input mask and then add one line code with help you figure it out.

check below code.


<script language="javascript" src="//code.jquery.com/jquery-1.4.4.min.js"></script>
<script src="//jquery-ui.googlecode.com/svn-history/r2369/branches/dev/mask/demos/mask/jquery.maskedinput.js" type="text/javascript"></script>

//script code to validate canadian postal code
<script type="text/javascript">
	$(document).ready(function() {
$('#txtPostalCode').inputmask("a9a-9a9");
	});
</script>

Hope that will save your time..

happy coding…

Posted by | View Post | View Group