title: Confirm message box in jquery
body: <p>I'm creating a confirm message box using <a href="http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/build-a-popup-modal-window-using-the-jquery-reveal-plugin/" rel="nofollow">this plugin</a>.</p>
  
  <pre><code>&lt;input type="button" id="deleteByID" value="Delete Item By ID" /&gt;
  &lt;div id="modal"&gt;
      &lt;div id="heading"&gt;
          Are you sure you want to do that?
      &lt;/div&gt;
      &lt;div id="content"&gt;
          &lt;a href="#" id='revealYes' class="button green close"&gt;&lt;img src="images/tick.png"&gt;OK&lt;/a&gt;
          &lt;a href="#" id='revealNo' class="button red close"&gt;&lt;img src="images/cross.png"&gt;Cancel&lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  $('#deleteByID').click(function(e) {
     $('#modal').reveal({
        animation: 'fade',
        animationspeed: 320,
        closeonbackgroundclick: true,
        dismissmodalclass: 'close'
     });
     $('#revealYes,#revealNo').click(function(){
        var choice = $(this).text();
        if(choice == 'OK'){
           deleteItemInCart(item5);
           updateQtyLabel('qtyItem');
        }else{
           return false;
        }
     });  
  });
  </code></pre>
  
  <ol>
  <li><p>I want to change the blog <code>#modal</code> into dynamic <code>div</code> as this function, how can I call this function in my page to create a <code>#modal</code> div as html above.</p>
  
  <pre><code> function messageBox(heading, confirmMsg, cancelMsg){
     var box = ' &lt;div id="modal"&gt;&lt;div id="heading"&gt;'+heading+'&lt;/div&gt;&lt;div id="content"&gt; &lt;a href="#" id="revealYes" class="button green close"&gt;&lt;img src="images/tick.png"&gt;'+confirmMsg+'&lt;/a&gt; &lt;a href="#" id="revealNo" class="button red close"&gt;&lt;img src="images/cross.png"&gt;'+cancelMsg+'&lt;/a&gt;';
     return box;
  }
  </code></pre></li>
  <li>In my console,function <code>deleteItemInCart()</code> increase executing time + 1 every time I click on <code>OK</code> button. I meant, when I click on the <code>OK</code> button 1st time, the function called 1 time then the message box closed. Then click on <code>OK</code> button 2nd time, the function is call 2 times in my console. Any idea what could be causing this</li>
  </ol>
  
  <p>Any help would be much appreciated, thank you.</p>