Manuel Yerbes
Manuel Yerbes

Reputation: 25

Open second popup when a popup is open in w2ui (w2popup)

I am working with the W2UI library, exactly with popups (https://w2ui.com/web/docs/2.0/popup).

I am opening a popup and at the same time, this popup has a button to open another popup. When I open the second popup, it replaces the first popup, so the first popup disappears.

I would like that when I open the second popup and when I close this one, the first popup is still active.

The function of the button that opens the first popup is:

$(document).on('click', '#cmdAddOverLayerCat', function() {
    openPopup();
});

The function to open the first popup, including the button to open the second popup:

function openPopup() {

    $().w2form({
        name: 'frmAddOverLayer',
        style: 'border: 0px; background-color: transparent;',
        formHTML: 

        '<div class="w2ui-field">' +
                '  <label>Open second popup:</label>' +
            '  <div>' +
            '    <button class="w2ui-btn" name="secondPopup" onclick="getSecondPopup();" type="button">Token</button>' +
            '  </div>' +
            '</div>' +          

}

Function that opens the second popup:

function getSecondPopup() {

    $().w2popup('open', {
        title   : 'secondPopup',
        body: 
            ...
            ,
    actions: {
        "Close": function () { w2popup.close(); }
    }
    });
}

Upvotes: 1

Views: 269

Answers (0)

Related Questions