Answers.Body: <p>I'm not sure what your Question is exactly and what your expected outcome is but to create a Modal you can use this HTML</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div id="my-awesome-modal" class="modal"&gt;
      &lt;div id="modal-body" class="body"&gt;
          &lt;header class="header"&gt;
              &lt;h2&gt;My Awesome Modal&lt;/h2&gt;
          &lt;/header&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and via JavaScript you can show it</p>
  
  <pre class="lang-JS prettyprint-override"><code>//create it
  var modal = new Garnish.Modal($('#my-awesome-modal')); 
  modal.show();
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-23T18:21:22.793Z
Answers.Text: I am not able to add any js event on my custom button which is created by adding a new action
Answers.UserDisplayName: inrsaurabh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-23T18:25:39.607Z
Answers.Text: Why are you not able to do that?
Answers.UserDisplayName: Robin Schambach
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-23T18:10:01.097Z
Answers.LastActivityDate: 2019-02-23T18:10:01.097Z
Answers.UserDisplayName: Robin Schambach
Body: <p>I created a new custom action.</p>
  
  <p>A new button is added in <code>getAvailableActions()</code> as we can se in below screenshot in red marked rectangle, now when i click on that button 
   (<code>Cusotm Action</code>) i want to open a pop up box ( i used <a href="https://github.com/pixelandtonic/garnishjs/blob/master/src/Modal.js" rel="nofollow noreferrer">Default pop up</a> js lib.</p>
  
  <p><a href="https://i.sstatic.net/ViGCW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ViGCW.png" alt="custombutton"></a></p>
  
  <p>Template File path : /craft/plugins/tagmanager/templates/_mergetags.twig</p>
  
  <pre><code>{% includeJsResource "tagmanager/js/tagmanager.js" %}
  
      &lt;div class="btn menubtn btnMeregeTags" role="button"&gt;{{ "Merge Tags"|t }}&lt;/div&gt;
      &lt;div class="menu"&gt;
      &lt;div id="mergetags-modal" class="modal"&gt; 
          &lt;div id="modal" class="body"&gt;
              &lt;header class="header"&gt;
                  &lt;h2&gt;Modal header&lt;/h2&gt;
              &lt;/header&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>js part</p>
  
  <pre><code>$(function () {
    $modal = new Garnish.Modal($('#mergetags-modal')); //create a new modal
    $modal.show();
  });
  </code></pre>
  
  <p><a href="https://i.sstatic.net/Iuz1z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Iuz1z.png" alt="default pop up"></a></p>
  
  <p>Not able to open pop up correctly.</p>
  
  <p>Thank you.</p>
  
Tags: <plugin-development><craft2>
Title: Open pop on click of custom action and get filled data
ThreadText: # Open pop on click of custom action and get filled data
  
  (Asked by: username_0 on 2019-02-18)
  
  I created a new custom action.
  
  A new button is added in `getAvailableActions()` as we can se in below screenshot in red marked rectangle, now when i click on that button
  (`Cusotm Action`) i want to open a pop up box ( i used [Default pop up](https://github.com/pixelandtonic/garnishjs/blob/master/src/Modal.js) js lib.
  
  [![custombutton](https://i.sstatic.net/ViGCW.png)](https://i.sstatic.net/ViGCW.png)
  
  Template File path : /craft/plugins/tagmanager/templates/\_mergetags.twig
  
  ```
  {% includeJsResource "tagmanager/js/tagmanager.js" %}
  
      <div class="btn menubtn btnMeregeTags" role="button">{{ "Merge Tags"|t }}</div>
      <div class="menu">
      <div id="mergetags-modal" class="modal"> 
          <div id="modal" class="body">
              <header class="header">
                  <h2>Modal header</h2>
              </header>
          </div>
      </div>
      </div>
  
  ```
  
  js part
  
  ```
  $(function () {
    $modal = new Garnish.Modal($('#mergetags-modal')); //create a new modal
    $modal.show();
  });
  
  ```
  
  [![default pop up](https://i.sstatic.net/Iuz1z.png)](https://i.sstatic.net/Iuz1z.png)
  
  Not able to open pop up correctly.
  
  Thank you.
  
  **Tags:** plugin-development, craft2
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-23. Score: 1
  
  I'm not sure what your Question is exactly and what your expected outcome is but to create a Modal you can use this HTML
  
  ```html
  <div id="my-awesome-modal" class="modal">
      <div id="modal-body" class="body">
          <header class="header">
              <h2>My Awesome Modal</h2>
          </header>
      </div>
  </div>
  
  ```
  
  and via JavaScript you can show it
  
  ```JS
  //create it
  var modal = new Garnish.Modal($('#my-awesome-modal')); 
  modal.show();
  
  ```
  
  > **Comments:**
  > **username_0**: I am not able to add any js event on my custom button which is created by adding a new action  
  > **username_1**: Why are you not able to do that?  
  
  ---
  
  