This file contains 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
// 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