Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

JavaScript Jquery datepicker resets to current date when page reloads

Mtrevor

New Coder
Hi guys I am developing an application using asp. net mvc, I have a page that has a date picker which has an on change method when clicked it reloads the whole entire page with the filtered data based on the date selected on the date picker. My problem is when the page reloads the date on the picker in the ui resets to the current date but I want it to set the selected date to be the one I've selected before. eg current date is 12 March 2021 when I select a new date like 05 April 2021 the page reloads and on the date picker it set it back to todays date but I want it to select the 12 March 2021.
 
What does your code look like? You'll probably have to pass the date as a parameter in your URL when you do the page reload, then update your date picker code to look for that parameter and change the date to the value of the parameter if it is present.
 
What does your code look like? You'll probably have to pass the date as a parameter in your URL when you do the page reload, then update your date picker code to look for that parameter and change the date to the value of the parameter if it is present.
Yes, I do pass the date as the parameter but unfortunately I can't share the code, but if you can share some code please do.
 

Buy us a coffee!

Back
Top Bottom