4

I loaded custom js in head section of grid ui component in order to open a model dialog box when i click a button.

require([
"jquery",
'Magento_Ui/js/modal/modal'
], function($, modal){

var options = {
    type: 'popup',
    responsive: true,
    innerScroll: true,
    title: 'Title',
    buttons: [{
        text: $.mage.__('Proceed'),
        class: '',
        click: function () {
            /* some stuff */
            this.closeModal();
        }
    }]
};
var popup = modal(options,$('#popup-modal'));

$("#print").click(function(){       
....
....}});    

Its throw an following error when page load

jquery.js:3762 Uncaught TypeError: Cannot read property 'nodeName' of undefined

can any one suggest please.

Thanks.

1 Answer 1

4

add this code you will resolve the problem

if ($("#popup-modal").length != 0) {

var popup = modal(options, $('#popup-modal')); 

jQuery('#popup-modal').modal('openModal');

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.