title: Using the jquery.confirm function on change event of checkbox
body: <p>I am using jquery.confirm which i picked up from <a href="http://myclabs.github.io/jquery.confirm/" rel="nofollow">http://myclabs.github.io/jquery.confirm/</a></p>
  
  <p>Objective :- I am trying to pop up a confirmation box with different text on check and uncheck of the checkbox. On check of the checkbox a confirmation box  should pop up showing the message <code>"Are You Sure to add the media"</code>, if user clicks "Yes I am", i am sending the corresponding ajax call for adding the media and making the checked property true. On uncheck of the checkbox the confirmation should pop up showing the message <code>"Are you Sure to delete the media"</code>, again if the user selects "Yes I am", a ajax call is being made with for deletion and checked property is set to false.</p>
  
  <p>The checkbox is:</p>
  
  <pre><code>&lt;input type="checkbox" id="media"&gt;
  </code></pre>
  
  <p>Now the issue is although the flow is going correctly, the confirmation box is showing the same textMessage on both check and uncheck of the checkbox. </p>
  
  <pre><code>"Are You sure to add the media".
  </code></pre>
  
  <p>Instead it should change the text since the textMessage is changing on each check and uncheck. This is the first time i am using the confirmation box.  </p>
  
  <p>This is the code. </p>
  
  <pre><code>var textMessage=" to add the media?";
      $('#media').change(function() {
              //var checked=$(this).is(":checked");
              var me=this;
              $("#media").confirm({
                              title:"Confirmation",
                              text:"Are You Sure" + textMessage,
                              confirm: function(btn) {
                                  if(textMessage === " to add the media"){
                                      $(me).prop("checked", true);
                                      mediachecked=false;
                                      textMessage=" to delete the media?";
                                      //Making the ajax calls for addition                                                          
                                      }
                                  else{
                                      $(me).prop("checked",false);
                                      mediachecked=true;
                                      textMessage=" to add the media?";
                                      //Making the ajax calls for deletion
                                      }
                              },
                              cancel: function(btn) {
                              },
                               confirmButton: "Yes I am",
                               cancelButton: "No"
                              });
          });
  </code></pre>
  
  <p>Thanks in advance for the help. </p>