Can you explain how to add popup(modal window) on button click in the adminhtml? I already create some phtml

<div id="messages">
<div class="messages">
    <?php foreach ($this->getCollection() as $reminder):
    <div class="message message-notice notice">
        <div data-ui-id="messages-message-notice">Customer name - <?php echo $reminder->getCustomerName()
            ?>(Order ID #<?php echo $reminder->getOrderIncrementId() ?>); Date/Time - <?php echo $reminder->getDatetime()
            ?>; Due Date/Time - <?php echo $reminder->getDuedatetime() ?>; Assigned to User - <?php echo $reminder->getName() ?>;
            Note - <?php echo $reminder->getTitle() ?><button class="action- scalable primary">asd</button></div>
    <?php endforeach; ?>

And I really need to know how to add modal action to the button.

1 Answer 1


Minimal example

<div id="messages">
       <div class="message"> MessageContents 
           <button class="primary">ClickMe</button>
<script type="text/javascript">// <![CDATA[
    function($, alert) {
       $('#messages').on('click', 'button.primary', function(event){
               content: $(event.target).parent().text()
// ]]></script>
  • :- i want magento2 default pop up with content can you please share working code, please share full code else it will confuse us so Commented Oct 30, 2015 at 8:29
  • its working i tried in front-end for that js is not included so through error Commented Nov 4, 2015 at 7:17
  • :- you answr is right but u need to add alert.js if you use in fronend Commented Nov 4, 2015 at 7:30

Your Answer

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

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