galvin Posted December 23, 2010 Share Posted December 23, 2010 New to JQuery... If I have this in the HEAD of my document (which works fine to display a blank field that, if you click, pops up a datepicker set to today's date)... <script> $(function() { $( "#datepicker" ).datepicker({ dateFormat: 'mm/dd/yy' }); }); </script> How would I implement this "Method" below? .datepicker( "setDate" , 11-11-2011) Basically, when someone goes to this page with the DatePicker, I want the date 11-11-2011 to appear in the field/datepicker by default. It sounds like this "setDate" Method is what I should use to do this, but I can't figure out where exactly to put this code (i.e. in the same script tags above, or somewhere else on the page), and need to know exactly how to write it. Can anyone help? Link to comment https://forums.phpfreaks.com/topic/222511-how-to-execute-a-jquery-method/ Share on other sites More sharing options...
Xtremer360 Posted December 23, 2010 Share Posted December 23, 2010 From my experiences its best not to use dashes use the backslash. And it should go right below dateFormat. .datepicker( "setDate" , 11/01/2011 ) Link to comment https://forums.phpfreaks.com/topic/222511-how-to-execute-a-jquery-method/#findComment-1150919 Share on other sites More sharing options...
.josh Posted December 24, 2010 Share Posted December 24, 2010 doing 11-11-2011 should be fine, just wrap it in quotes. And yeah, since you want it to be the "defaule" date, call it right after the first code you have (the dateFormat). Link to comment https://forums.phpfreaks.com/topic/222511-how-to-execute-a-jquery-method/#findComment-1151140 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.