Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active October 11, 2019 21:22
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 Shelob9/6677e981b974577d21b2a9e92bee62d8 to your computer and use it in GitHub Desktop.
Save Shelob9/6677e981b974577d21b2a9e92bee62d8 to your computer and use it in GitHub Desktop.
JavaScript events that run when Caldera Forms conditional logic adds or removes fields See: https://calderaforms.com/doc/cf-state-cf-events-caldera-forms-javascript#cf-add
//Run JavaScript when a field is added using conditional logic
jQuery( document ).on( 'cf.add', function(){
console.log('cf.add triggered' );
});
//Run JavaScript when a field is removed using conditional logic
jQuery( document ).on( 'cf.remove', function(){
console.log('cf.remove triggered' );
});
@lavert
Copy link

lavert commented Oct 11, 2019

Why does the cf.add event fire twice when used as is above? For example, a single field is made visible on click, but the cf.add event still fires twice from the single click?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment