Magento – How to remove header or footer from modal popup in magento 2

magento2modal-popuppopup

I have created popup on href click and on click popup is opening fine. But I want to remove Continue button from modal-footer which is just used to close the popup. Want to remove it. Any idea?

modal-form.js is as below.

define([
    'jquery',
    'Magento_Ui/js/modal/modal'
],
function($) {
    "use strict";
    //creating jquery widget
    $.widget('Vendor.modalForm', {
        options: {
            modalForm: '#personilized-modal-form',
            modalButton: '.open-modal-form'
        },
        _create: function() {
            this.options.modalOption = this._getModalOptions();
            this._bind();
        },
        _getModalOptions: function() {
            /**
             * Modal options
             */
            var options = {
                type: 'popup',
                responsive: true,
                title: 'Personilized Custom Jewelery',
                buttons: [{
                    text: $.mage.__('Continue'),
                    class: '',
                    click: function () {
                        this.closeModal();
                    }
                }]
            };

            return options;
        },
        _bind: function(){
            var modalOption = this.options.modalOption;
            var modalForm = this.options.modalForm;

            $(document).on('click', this.options.modalButton,  function(){
                //Initialize modal
                $(modalForm).modal(modalOption);
                //open modal
                $(modalForm).trigger('openModal');
            });
        }
    });

    return $.Vendor.modalForm;
});

Best Answer

Why not just remove buttons from footer?

_getModalOptions: function() {
    /**
     * Modal options
     */
    var options = {
        type: 'popup',
        responsive: true,
        title: 'Customer Details',
        buttons: []
    };

    return options;
},
Related Topic