This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Include your JS into a normal file, just how you are used to and enqueue it with wp_enqueue_script. This will not work in the editor, because you want the functions to fire when you add them. | |
At the beginning of your widget file, add ‘use Elementor\Plugin;’. | |
Then at the end of the render() function in your PHP, add this: | |
<?php if ( Plugin::$instance->editor->is_edit_mode() ) : ?> | |
<script>Your code here</script | |
<?php |