What are the two Common jQuery Widgets in Magento 2 platform?

Do you know Magento 2 enables multiple jQuery widgets?

They are very useful when you’re coding extensions on Magento 2. In this article, I will establish two common jQuery widgets in Magento 2. They are Confirmation and Alert widgets.

Looking to build a customized online marketplace? If so, click here and get started at just $249!!!

Two Common jQuery Widgets in Magento 2

Confirmation Widget in Magento 2

The Magento Confirmation Widget enables a modal popup window to cancel and confirm button. It is the Magento Sample Widget extension.

The confirmation widget source is

Magento_Ui_module_dir>/view/base/web/js/modal/confirm.js

The widget can be used to activate the confirmation windows for both the admin and storefront.

require([

    'Magento_Ui/js/modal/confirm'

], function(confirmation) { // Variable that represents the `confirm` widget

      confirmation({

        title: 'Title',

        content: 'Content',

        actions: {

            confirm: function(){},

            cancel: function(){},

            always: function(){}

        }

    });

});

Alert widget in Magento 2

The Magento alert widget enables a modal popup window with a confirm button. It extends the Magento 2 Sample widget. The alert widget is the source.

Magento_Ui_module_dir>/view/base/web/js/modal/alert.js

The widget can be used to activate the alert windows for both the admin and storefront.

require([

    'Magento_Ui/js/modal/alert'

], function(alert) {  

    alert({

        title: 'Title',

        content: 'Content',

        actions: {

            always: function(){}

        }

    });

});

The above-mentioned steps are the simplest process for you to do confirmation and alert jQuery Widgets in Magento 2.

Contact us to develop an online store with Magento 2 platform here today!!!

jQuery Widgets in Magento 2 - Magento 2 multi-vendor marketplace extension


Posted

in

,

by

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *