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.
- <script type="application/javascript">
- $('#from').datepicker({
- setDate: <?php echo $set['dateFrom'] ?> ,
- minDate: new Date(<?php echo setDatejQuery($set['dateFrom']) ?>),
- maxDate: new Date(<?php echo setDatejQuery($set['dateTo']) ?>),
- dateFormat: "dd-mm-yy"
- });
-
- $('#to').datepicker({
- setDate: <?php echo $set['dateTo'] ?> ,
- minDate: new Date(<?php echo setDatejQuery($set['dateFrom']) ?>),
- maxDate: new Date(<?php echo setDatejQuery($set['dateTo']) ?>),
- dateFormat: "dd-mm-yy"
- });
- </script>
- <script type="text/javascript" src="../js/Reservation-edit.js"></script>