Last active
June 12, 2023 21:08
-
-
Save coulterpeterson/6520ce03e61410da9d18ab9b236bd235 to your computer and use it in GitHub Desktop.
Gravity Forms | Disable Field or Sub-Field
This file contains hidden or 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 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