Skip to content

Instantly share code, notes, and snippets.

@geekontheroad
Last active June 4, 2022 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geekontheroad/ba773cf593e22291656d832e87e966ef to your computer and use it in GitHub Desktop.
Save geekontheroad/ba773cf593e22291656d832e87e966ef to your computer and use it in GitHub Desktop.
This small jQuery snippet for gravity forms will de-select all other radio button choices. (with the same class) Essentially this makes different radio buttons work together and it makes sure that only one radio button over different radio fields can be selected
/**
* This small jQuery snippet will de-select all other radio button choices. (with the same class)
* Essentially this makes different radio buttons work together and it makes sure that only one radio button over different radio fields can be selected
*
* INSTRUCTIONS
* Add the css class "gotr_limit_radio" to any radio field that needs this feature.
* Copy the below snippet into a html field and wrap it between <script> Snippet goes Here </script>
* Save the form.
*
* Update 04/06/2022
* Added compatibily for conditional logic
*
*author: Johan De Reiziger
*link: https://geekontheroad.com
*
**/
jQuery(".gotr_limit_radio input[type=radio]").on("click", function() {
jQuery(".gotr_limit_radio input[type=radio]").not(this).prop("checked",false).change();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment