Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger an event on custom elementor button widget?

I have a requirement where I need to create a custom widget to Elementor. I will have two text fields and a button on this widget and when I click on Button. I have to trigger an event.

But, I am not getting any button Id on the HTML page when I tried to create a button using this code.

          'submit_content',
          [
            //'label' => __( 'Submit Content', 'plugin-name' ),
            'type' => \Elementor\Controls_Manager::BUTTON,
            'separator' => 'before',
            'button_type' => 'success',
            'text' => __( 'Submit Product', 'plugin-domain' ),
            'event' => 'namespace:editor:submit',
          ]
        );

Is there any way, I can create any id with this button? Or any way I can use this button on click event at javascript or PHP side?

like image 832
tehDeveloper Avatar asked Jan 27 '26 21:01

tehDeveloper


1 Answers

jQuery(window).on("elementor/frontend/init", function() {
    elementor.channels.editor.on('namespace:editor:submit', function() {
        console.log('Try this!');
    });
});
like image 196
Nazmul Sabuz Avatar answered Jan 30 '26 10:01

Nazmul Sabuz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!