I’m using the gform_post_render javascript hook to add a class to input fields if they have a value. Basic sample:
$(document).on(‘gform_post_render’, function()
I have this code in a separate JS file. If the form is ajax, it works. If the form is not ajax, it does not work. However if I put the same code in a script tag underneath the short code that prints the form (in the template php file) it works.
Due to that I now have that code repeated a few times. Once in a JS file for ajax forms, and a couple more in template files for my non ajax forms. Is there a way to make all forms us just the code in the JS file?