How to add more than one custom javascript?

Hi,
Hoping for some help please.
Under form setting I have customer java.

  1. code works as follows:
    gform.addFilter( ‘gform_datepicker_options_pre_init’, function( optionsObj, formId, fieldId ) {
    // Apply to field 1 only
    if ( fieldId == 1 ) {

optionsObj.minDate = 0;
optionsObj.maxDate = ‘+1 M’;

}
return optionsObj;
});
But when I then add 2. code underneath neither of them works:
<script type= "text/javascript" >

jQuery( function () {

jQuery( ".datepicker" ).datepicker({ }).attr( 'readonly' , 'readonly' );

});

</script>

Can you please share with us the whole code? Some of it is being formatted strangely in the forum. I recommend posting your code to a code-sharing site, and then sharing the URL here so we can review it. Thank you.

Hi Chris,

The number 1. is already there and working in form settings under each gravity form. Just added number 2. code directly underneath and neither of them works.

gform.addFilter( ‘gform_datepicker_options_pre_init’, function( optionsObj, formId, fieldId ) {
// Apply to field 1 only
if ( fieldId == 1 ) {

optionsObj.minDate = 0;
optionsObj.maxDate = ‘+1 M’;

}
return optionsObj;
});
jQuery( function () {

jQuery( “.datepicker” ).datepicker({ }).attr( ‘readonly’ , ‘readonly’ );

});

© 2008 - 2019. Gravity Forms is a project by Rocketgenius Inc.