Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7895583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:40:43+00:00 2026-06-03T07:40:43+00:00

I have an INPUT tag with the value attribute set to 15-May-2012 and I

  • 0

I have an INPUT tag with the value attribute set to “15-May-2012” and I have initialized a JQuery UI Datepicker with it as follows:

<input type="text" name="schedule" id="schedule"
      value="15-May-2012">

<script type="text/javascript">
  $(function() {
    $( "#schedule" ).datepicker();
    $( "#schedule" ).datepicker( "option", "dateFormat", "d-M-yy" );
  });
</script>

For some reason, the value of the INPUT tag is being cleared once the Datepicker is initialized. Note that the value in the INPUT field matches the format set for the Datepicker.

Why is the value cleared?

Here is a live example of it: http://agnelkurian.com/lab/datepicker_example.html

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:40:44+00:00Added an answer on June 3, 2026 at 7:40 am

    When you bind the datepicker:

    $('#schedule').datepicker();
    

    it will use the default dateFormat and that is "mm/dd/yy"; your "15-May-2012" doesn’t match that format so the datepicker clears it when it fails to parse it using "mm/dd/yy". Then you change the format:

    $("#schedule").datepicker("option", "dateFormat", "d-M-yy");
    

    but the value has already been lost.

    You should set the format when you bind the datepicker:

    $("#schedule").datepicker({
        dateFormat: 'd-M-yy'
    });
    

    Demo: http://jsfiddle.net/ambiguous/mHyn7/
    ​

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have html like that <input type=radio name=Gander value=M id=Male />Male <input type=radio name=Gander
HTML code: <input id=txtSizeBeforeValue type=text size=5 value=blabla> <input id=txtValueBeforeSize type=text value=blabla size=5> HTML parsed
<form id=search action=/search method=get autocomplete=off> <div> <input type=button name=test_button value=test /> </div> </form> <script>
I have an HTML tag with a short maxlength but a long value attribute.
I have this basic example: <!doctype HTML> <html> <head> <script src=jquery-1.4.2.min.js type=text/javascript></script> <script> $(document).ready(function(){
i have this tag as input tag: <a href=controller.jsp?sid=127490C88DB5&R=35144 class=11-link-dkred-bold><b>Mr. John Q. Anderson&nbsp;&nbsp;&nbsp;MBA 1977
My input tag started to go crazy... I have html form for input to
In the settings.php i have some input for the realname,hobby,city and select tag for
In my HTML code, I have a form tag that contains two input boxes,
I have an arraylist set up. I have input instuctions set up too, so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.