How to use setting only one time and then use defaults in jQuery?

How to use setting only one time and then use defaults in jQuery?

Hi
I am using datepicker UI so when a user click to edit a page the selected dates are depending one a value in the database fields. So how can i initialize the options only once. After that i want to use the original settings.


here is what i am doing so the first part of the code need to set the current values and setting and then the file  Reservation-edit.js has the setting to use after the load.

The question is how to change the first part of my code to run once when the page is loaded.

  1. <script type="application/javascript">
  2. $('#from').datepicker({
  3. setDate:  <?php echo $set['dateFrom'] ?> ,
  4. minDate:  new Date(<?php echo setDatejQuery($set['dateFrom']) ?>),
  5. maxDate:  new Date(<?php echo setDatejQuery($set['dateTo']) ?>),
  6. dateFormat: "dd-mm-yy"
  7. });
  8. $('#to').datepicker({
  9. setDate:  <?php echo $set['dateTo'] ?> ,
  10. minDate:  new Date(<?php echo setDatejQuery($set['dateFrom']) ?>),
  11. maxDate:  new Date(<?php echo setDatejQuery($set['dateTo']) ?>),
  12. dateFormat: "dd-mm-yy"
  13. });
  14. </script>

  15. <script type="text/javascript" src="../js/Reservation-edit.js"></script>