fbpx

JS code in Elementor popup

To run Javascript code from a custom widget in an Elementor popup you will need to use this code snippet. 

We made the code snippet available directly from the widget creator for ease of usage.

  1. Click the Javascript Tab
  2. Click the show code examples link on the bottom.
  3. Click the “JS Code Snippets” link on the right sidebar
  4. Click the “Code Wrapper for Elementor Popup”

Note:

Your code should start from this function. Make sure you have some element with a dynamic ID {{uc_id}} in the HTML code tab.

For example: <div id=”{{uc_id}}”></div>

For your convenience you can also copy the code below.

				
					jQuery(document).ready(function(){	
function {{uc_id}}_start(){
      	
      	/* Put code here */ 
        
    	console.log("This code works!"); 
    	
}if(jQuery("#{{uc_id}}").length) {{uc_id}}_start(); else
	jQuery( document ).on( 'elementor/popup/show', () => { if(jQuery("#{{uc_id}}").length) {{uc_id}}_start();});
});
				
			

Download is just a click away

Get instant access to tons of Elementor goodies, completely FREE!

Hurray!

You got FREE access to the worlds leading widgets for Elementor page builder!