Skip to content

Instantly share code, notes, and snippets.

@coulterpeterson
Last active June 12, 2023 21:08
Show Gist options
  • Save coulterpeterson/6520ce03e61410da9d18ab9b236bd235 to your computer and use it in GitHub Desktop.
Save coulterpeterson/6520ce03e61410da9d18ab9b236bd235 to your computer and use it in GitHub Desktop.
Gravity Forms | Disable Field or Sub-Field
/**
* Gravity Wiz // Gravity Forms // Disable Field or Subfield
* https://gravitywiz.com/
*
* Instructions:
*
* 1. Install this snippet with our free Custom JavaScript plugin.
* https://gravitywiz.com/gravity-forms-custom-javascript/
* 2. Replace "1_2" with the ID of your field and the sub-field ID (in the case of an address field, for example),
* or replace the "1_2" with your field id only, if it's a single field.
*
*/
// When the page is ready
window.addEventListener('load', function () {
if (document.querySelector('body') !== null) {
let formField = document.querySelector('#input_GFFORMID_1_2');
formField.setAttribute("disabled", "true");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment