MySQL Date Fields and PHP and jQueryUI |
Here's how to quickly make jQuery UI work with MySQL date fields. Insert these scripts in the head of the document: <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.4.custom.min.js"></script> <script type="text/javascript"> $(function(){ // Datepicker $('#datepicker').datepicker({ inline: true }); //hover states on the static widgets $('#dialog_link, ul#icons li').hover( function() { $(this).addClass('ui-state-hover'); }, function() { $(this).removeClass('ui-state-hover'); } ); }); </script> Make sure to set your input like this: <td><input type="text" name="ck_date" value="" size="32" id="datepicker"></td> Then, to get MySQL to work with a date field, change this: $('#datepicker').datepicker({ inline: true }); To this: $('#datepicker').datepicker({ dateFormat: 'yy-mm-dd' }); |
Archives