Search code examples
jqueryjquery-ui-datepicker

jQuery datepicker automatically resets after editing textbox


My datepicker (jQuery + highcharts) after editing textfield automatically resets to the previous value. Example: I have date: 2012-10-24 and change it in the textbox to 2012-10-12. When I finish typing it automatically changes to 2012-10-24. The text field has no readOnly attribute set to true. How can I prevent this change?


Solution

  • Are you using ASP MVC by chance? Because if you are, and the date field you're talking about is linked to your model you might want to check whether you linked that model property correctly to the control.

    In any other case, you should make sure you're not resetting the date fields value anywhere in your script code.

    $(document).ready(function(){
        $("#dtField").datepicker();
    });
    

    Here's a Fiddle of what I think you described.