blob: 93c34d5ccd79d96c7e91ffc166f997da561495fa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
(function() {
// Add datepickers to all `js-access-expiration-date` elements. If those elements are
// children of an element with the `clearable-input` class, and have a sibling
// `js-clear-input` element, then show that element when there is a value in the
// datepicker, and make clicking on that element clear the field.
//
this.MemberExpirationDate = function() {
$('.js-access-expiration-date').each(function(i, element) {
var expirationDateInput = $(element);
if (expirationDateInput.hasClass('hasDatepicker')) { return; }
function toggleClearInput() {
expirationDateInput.parent().toggleClass('has-value', !!expirationDateInput.val());
}
expirationDateInput.datepicker({
dateFormat: 'yy-mm-dd',
minDate: 1,
onSelect: toggleClearInput
});
expirationDateInput.on('blur', toggleClearInput);
toggleClearInput();
expirationDateInput.next('.js-clear-input').on('click', function(event) {
event.preventDefault();
expirationDateInput.datepicker('setDate', null);
toggleClearInput();
});
});
};
}).call(this);
|