I have a form with Jquery Datepicker and i can save the date in the database.
But when i reload the form to update the datas, i would like to have Jquery Datepicker showing the date previoulsy recorded in the database.
I can load it with php. I just need to update the datepicker.
In the documentation, i see :
beforeShowType: Function( Element input, Object inst ) Default: null A function that takes an input field and current datepicker instance and returns an options object >to update the datepicker with. It is called just before the datepicker is displayed.
I think it can be the solution. Could someone give me an example ?
I have a form with Jquery Datepicker and i can save the date in the database.
But when i reload the form to update the datas, i would like to have Jquery Datepicker showing the date previoulsy recorded in the database.
I can load it with php. I just need to update the datepicker.
In the documentation, i see :
beforeShowType: Function( Element input, Object inst ) Default: null A function that takes an input field and current datepicker instance and returns an options object >to update the datepicker with. It is called just before the datepicker is displayed.
I think it can be the solution. Could someone give me an example ?
Share Improve this question asked Oct 11, 2012 at 21:12 Sébastien GicquelSébastien Gicquel 4,3867 gold badges57 silver badges87 bronze badges1 Answer
Reset to default 5What did you attach the datepicker to? If you attached it to an input, then you just need to set the value of the input before calling datepicker() on it.
If you haven't initialized the datepicker yet, you can do:
$( '#yourElement' ).datepicker({ defaultDate: yourDate });
Otherwise, you can call the setDate method to set the date on an already initialized datepicker:
$( '#yourElement' ).datepicker( 'setDate', yourDate );
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745255001a4618901.html
评论列表(0条)