title: How to pass params as a function and call it after button is clicked
body: <p>I create my custom delete with function and parameters like this</p>
  
  <pre><code>function boxAlert(params){
     $('body').append(
       '&lt;div class="box"&gt;' +
          '&lt;div&gt;' +params.message+ '&lt;/div&gt;' +
          '&lt;button onclick="' +params.action()+ '"&gt; YES &lt;/button&gt;' +
       '&lt;/div&gt;'
     );
  }
  </code></pre>
  
  <p>then I use it like this</p>
  
  <pre><code>&lt;button onclick="_delete()"&gt; Delete Data &lt;/button&gt;
  
  &lt;script&gt;
     function _delete(){
        boxAlert({
           message: 'Lorem ipsum dolor?',
           action: function(){ // call this after button is clicked
              alert();
           }
        });
     }
  &lt;/script&gt;
  </code></pre>
  
  <p>It's work but, the alert is called before YES button is clicked, I want alert is called after YES button is clicked, how to solve it? thank you so much </p>