hi i want to know that how can i show pop when a link or say button is clicked. i know how to display pop up on over a click in PHP but am completely unaware about it in magento coz i have never tried that.

in case of displaying popup in php we can use this code

<a href="link"  target="popup"  onclick="window.open('yourLink','popup','width=600,height=600,scrollbars=no,resizable=no'); return false;">
    Open Popup

can i use same code for magento also

do i have to use any custom module to achieve this or it is possible thorough .phtml file.

1 Answer 1


Use below code in your phtml file for Magento popup model

<a id="click-me" href="link">
    Open Popup
<div id="popup-modal" class="popup" style="display: none;">
<script type="text/javascript">
require(['jquery', 'Magento_Ui/js/modal/modal'], function( $, modal ) {
    var options = {
        type: 'popup',
        responsive: true,
        innerScroll: true,
        buttons: [{
            text: 'Continue',
            class: 'mymodal1',
            click: function () {

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


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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