Created
March 12, 2018 17:21
-
-
Save carolina-vallejo/fd77e5dda4a66b68c0bc844f3edc0134 to your computer and use it in GitHub Desktop.
date-picker-afterShow.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$.datepicker._updateDatepicker_original = $.datepicker._updateDatepicker; | |
$.datepicker._updateDatepicker = function(inst) { | |
$.datepicker._updateDatepicker_original(inst); | |
var afterShow = this._get(inst, 'afterShow'); | |
if (afterShow) | |
afterShow.apply((inst.input ? inst.input[0] : null)); // trigger custom callback | |
} | |
$( "#datepicker" ).datepicker({ | |
beforeShow : function(input, inst) { | |
var today = $('.ui-datepicker-today'); | |
if (today.length) { | |
$('.message-before').append(today.find('a').html()+'<br>'); | |
} else { | |
$('.message-before').append('Today DOM element is not rendered yet.<br>'); | |
} | |
}, | |
afterShow : function(inst) { | |
var today = $('.ui-datepicker-today'); | |
if (today.length) { | |
$('.message-after').append(today.find('a').html()+'<br>'); | |
} else { | |
$('.message-after').append('Today DOM element should be already rendered.<br>'); | |
} | |
}, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment