Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting Textbox into MM/YYYY

I have a textbox in my web forms (ASP.NET Web Forms) which I want to show something like this:

MM/YYYY

I want this "/" in the middle when user is entering the month and year. How should I do this on C#?

like image 339
RG-3 Avatar asked Dec 27 '22 19:12

RG-3


1 Answers

I would take a look at the Masked Input jQuery plugin:

https://plugins.jquery.com/maskedinput/

Seems like it would fit nicely for what you need to do.

Implementation looks like this:

jQuery(function($){
   $("#date").mask("99/99/9999");
   $("#phone").mask("(999) 999-9999");
   $("#tin").mask("99-9999999");
   $("#ssn").mask("999-99-9999");
});

You can see demos here:

http://digitalbush.com/projects/masked-input-plugin/

like image 168
Abe Miessler Avatar answered Dec 30 '22 10:12

Abe Miessler