title: How to make event click event fire only once when element is clicked multiple times
body: <p>I have a link that the user clicks on to delete a record (<code>class="delMail"</code>). When they click this link, a new div shows up with 2 more links [Y and N]. clicking on Y will delete their email, clicking on N will cancel the request.  </p>
  
  <p>The problem is that if the user clicks 10 times on the delMail link prior to clicking on either Y/N, the code will try to delete the email 10 times also?</p>
  
  <p>I've updated my code to my working version, here it is: </p>
  
  <pre><code>$(function(){ //delete Message
      $("a.delMail").click(function(e) {
          e.preventDefault();
          //get divs to show and hide
          var $confirmDelDiv = $(this).parents("tr").next().find(".confirmDelete");
          var $replyDiv = $(this).parents("tr").next().next().find(".replyDiv");
  
              $replyDiv.fadeOut(); //hide reply div
              $confirmDelDiv.fadeIn("slow"); //show confirm message
  
              //get id
              var $id = $(this).attr("href"); //get id value of email
              var dataString = "id="+$id;
  
              $("a.delLinkYes").click(function(y){//if user confirms delete, send id to php page
                  y.preventDefault(); $(this).unbind("click");
                      $.ajax({
                              type: "POST",
                              url:  "process.php",
                              action: "deleteEmail",
                              data:  dataString,
                              dataType: "JSON",
                              cache: false,
                              success: function(data){
                                  if(data == "true"){//if email was successfully deleted
                                      $confirmDelDiv.delay(60).append("Email deleted!");
                                      $confirmDelDiv.fadeOut("slow");
                                  }else{$confirmDelDiv.delay(60).append("Error deleting this email. Please try again!"); return false;}
                              }
                      });
                      return false;
                  });
  
              $("a.delLinkNo").click(function(n){//if user cancels request, stop.
                  $(this).unbind("click");alert("cancel"); return false; 
                  //$confirmDelDiv.fadeOut("slow"); return false;
              });
      });
  });
  </code></pre>
  
  <p>Is this ok? I mean efficiency wise?</p>