jQuery keeps resetting a field


I have a form on WordPress where a user can create a post and set a deadline. The deadline field uses jQuery’s datepicker. All this information is then passed to a preview page.

On the form page, I added the following jQuery code to restrict the range of dates the user can pick (currently 30 days from the current date). But when they go to preview the post, the deadline date disappears. It’s almost like the jQuery causes it not to be passed to the preview stage or resets it somehow. BTW the jQuery only runs once, on the form page.

$( function() {
$( "#post_deadline" ).datepicker({ minDate: -0, maxDate: "+30D" });
} );

Does anyone know why this is happening? I thought the jQuery would only affect the date the user can select, not the passing of this data to the preview page.

Any help is very much appreciated.


michael74 2 years 2020-12-29T12:10:25-05:00 0 Answers 2 views 0

Leave an answer