JQuery ui 1.7.3 datepicker set selected date + 3 days

How can I set the selected date jquery datepicker by adding 3 days to the actual date?

As from 11/01/2011 to 11/04/2011

My current code is not working!

<script type="text/javascript"> $(function() {$("#datepicker").datepicker();}); //Set DatePicker to actual date + 3 days $('#dateselector').datepicker("setDate", new Date(date.getMonth()+"/"+(date.getDate()+3)+"/"+date.getFullYear()) ); </script> 
+4
source share
1 answer
 $('#datepicker').datepicker("setDate", "+3"); 

Working example: http://jsfiddle.net/EryYr/1/

Quote from the documentation:

SETDATE .datepicker( "setDate" , date ) ... The new date can be a Date object or a string in the current date format (for example, '01 / 26/2009 '), a few days from today (for example, +7) or strings of values ​​and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for several days, for example. '+ 1m + 7d'), or null to clear the selected date .

+9
source

Source: https://habr.com/ru/post/1381332/


All Articles