jquery datepicker date default
can anyone tell me why datepicker submits the current d开发者_开发技巧ate when a input field is empty? i need to have this field empty so if a user does not wish to enter a date, then no data is sent. is there a way to do that? many thanks
according to the documentation
Set the date to highlight on first opening if the field is blank. Specify either an actual date via a Date object or as a string in the current dateFormat, or a number of days from today (e.g. +7) or a string of values and periods ('y' for years, 'm' for months, 'w' for weeks, 'd' for days, e.g. '+1m +7d'), or null for today.
Code examples
Initialize a datepicker with the defaultDate option specified.
$( ".selector" ).datepicker({ defaultDate: +7 });
Get or set the defaultDate option, after init.
//getter
var defaultDate = $( ".selector" ).datepicker( "option", "defaultDate" );
//setter
$( ".selector" ).datepicker( "option", "defaultDate", +7 );
精彩评论