Skip to content

Instantly share code, notes, and snippets.

@Crocoblock
Last active June 18, 2025 08:50
Show Gist options
  • Save Crocoblock/b037cc64932b4448bc873b42dd34583a to your computer and use it in GitHub Desktop.
Save Crocoblock/b037cc64932b4448bc873b42dd34583a to your computer and use it in GitHub Desktop.
JetPopup trigger open / close
//128 is a popup ID
let popupId = 'jet-popup-128',
data = {
popupId: popupId,
};
//Open popup
jQuery( window ).trigger( {
type: 'jet-popup-open-trigger',
popupData: data
} );
//Close popup
jQuery( window ).trigger( {
type: 'jet-popup-close-trigger',
popupData: data
} );
//Open Listing popup
//Popup AJAX Loading and Force Loading should be set to On
//Popup should be present on the page (check popup conditions))
//
//replace 1201 in popupId property with popup ID
//postId is an item ID
//if queryId is greater than 0 and is valid query ID - listingSource will be overriden with query builder query ID (found in URL on query edit screen)
let data = {
popupId: 'jet-popup-1201',
isJetEngine: true,
listingSource: 'posts',
queryId: 0,
postId: 1189
}
jQuery( window ).trigger( {
type: 'jet-popup-open-trigger',
popupData: data
} );
//Open / close popup on JetFormBuilder form submit
jQuery( document ).on( 'jet-form-builder/ajax/on-success', formHandle );
function formHandle( event, response, $form ) {
//response is an object with properties:
//- status - success
//- message - success message
//- any other data added to response
//
//$form is a form jQuery object
//open / close popup
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment