javascript - bootstrap-datepicker empties field after selecting current date -
If I have autocalues enabled, and I select the field from the calendar that was previously selected, this field will be empty And then closes, as expected, datepicker can still get the AutoCoos feature, but is this field empty?
For example, look at the demo,
- Make sure AutoCaus is on
- Select a date.
- Open the date picker again, choose the currently selected date again.
- The field is empty again
thanks
The Bootstrap provides date pictures that you can take advantage of to accomplish your goal.
Here's the way to do this:
$ ('# sandbox-container input'). The dates ({autoclus: true}); $ ('# Sandbox-container input') ('Show', function (e) {if (e.date) {$ (this). Data ('sticky date', e.date);} and {$ (this). Data ('sticky date', empty );}}); $ ('# Sandbox-container input') ('Hide', function (e) {var stickyDate = $ (this). Data ('sticky date'); if (! E.date & stickyDate) {$ (this) .Det Picker ('Set date ', Sticky date); $ (this). Data (' sticky date ', blank);}});
Not necessarily the most elegant, but as you can see here, this is the trick:
(tested in Chrome)
Comments
Post a Comment