Skip to content

Instantly share code, notes, and snippets.

@qstudio
Last active November 11, 2019 12:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qstudio/bc665e939f93b82a9d59 to your computer and use it in GitHub Desktop.
Save qstudio/bc665e939f93b82a9d59 to your computer and use it in GitHub Desktop.
// Gravity Forms Post Render ##
$( document ).bind( 'gform_post_render', function(){
// notify ##
//console.log("GF Rendered");
// look for li.limit_date ##
if ( $("li.limit_date").length ) {
// default mindate and maxdate values ##
$maxdate = '';
$mindate = '';
// get all classes added to li ##
var classList = $('li.limit_date').attr('class').split(/\s+/);
// loop over classes ##
$.each(classList, function( index, item ) {
// check for min date ##
if ( /min_date/i.test( item ) ) {
$mindate = item.split('min_date_')[1];
}
// check for max date ##
if ( /max_date/i.test( item ) ) {
$maxdate = item.split('max_date_')[1];
}
});
$( "li.limit_date .datepicker" ).datepicker({
changeMonth: true,
changeYear: true,
minDate: $mindate,
maxDate: $maxdate
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment