We help IT Professionals succeed at work.
Get Started

jquery masked input plugin date formatting

maqskywalker asked
Last Modified: 2017-11-10
I'm using the masked input plugin

Example 1

I have this fiddle

<input id="date" type="text"></input>


When I apply the above date format mask on the textbox it works fine.

Example 2

Now I revised example 1 to this. I am basically setting a default value on the texbox.
This is how i need the textbox to be on page load.


<input id="date" type="text" value="11/5/2017"></input>


The masking is getting set on the textbox but notice how the default value doesn't display on the textbox on page load.

It only works if i set the days to double digits like this:

<input id="date" type="text" value="11/05/2017"></input>

How do I fix example 2,
so regardless whether the textbox value is single digits value="11/5/2017" or double digits value="11/05/2017" it will display on the masked textbox on page load?
Watch Question
Database Expert
Awarded 2016
Top Expert 2016
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE