Closing Caldera Forms Modals Using JavaScript


Caldera Forms has an option to allow your forms to appear on the screen as a link or button and then open as a pop up modal. This works automatically, requiring no additional code. If you would like to program some other way for the modal to close, besides clicking on the close button or submitting the form, you can accomplish this using JavaScript.

Make sure to modify the data attribute being targeted with the correct form ID for your form. You can then bind this code to some other event of your choosing:

Caldera Forms modals use the Remodal library. See this section of the Remodal documentation for information on opening and closing modals.

Opening Caldera Forms Modals Using JavaScript