Description
The gform/theme/scripts_loaded
event can be used to initialize scripts that depend on Gravity Forms front-end form scripts, including the JavaScript gform
object.
Usage
The gform/theme/scripts_loaded
event can be used with the standard addEventListener
method:
document.addEventListener('gform/theme/scripts_loaded', () => {
// Do something.
});
Parameters
This event isn’t passed any parameters.
Examples
Adding an async filter
The following example shows how you can add an async filter that uses a method on the gform
JavaScript object.
document.addEventListener('gform/theme/scripts_loaded', () => {
gform.utils.addAsyncFilter('gform/submission/pre_submission', async (data) => {
// Do something.
return data;
});
});
Placement
Reference the article Adding JavaScript Code to the Frontend of Your Site.
Since
This event was added in Gravity Forms v2.9.0
Source Code
This event is located in init()
in /assets/js/src/theme/core/ready.js.