Javascript modal breaks itself?

The code below opens a modal, and then executes a series of jQuery calls on some form controls. It works. Form submission works. Everything is great EXCEPT.... after you complete the form, or just close the modal, the anchor tags with the requestFeedback class stop responding, which means you can only execute this ONCE. If you refresh the page, all is well again until you click any of the request feedback links that have the requestFeedback class.

Where should I look to figure out what is causing this?

    $(".requestFeedback").click(function(e){
      /* Set the ID */
      var request_id = $(this).data('cid');
      $("#modalRequestID").text(request_id);

      $("#modalRequestFeedback").on('show.bs.modal', function(e){
        /* Hook the help link */
        $(".showRequestFeedbackHelp").click(function(e){
          $("#requestFeedbackHelp").toggle('slow');
        });
        /* Add select2() to the worker select */
        $("#getFeedbackFrom").select2({
          placeholder: "Get feedback from...",
          allowClear: true,
          width:'100%'
        });

        /* Make the date a calendar. */
        $("#feedbackDeadline").datetimepicker();

        /* Bind the submit button to do some work. */
        $("#sendFeedbackRequests").click(function(e){
          var sendTo = JSON.stringify($("#getFeedbackFrom").val());
          var requestor = <?php echo $current_user->users_id; ?>;
          var requirement_id = request_id;
          var ed = tinymce.get('feedbackMesage');
          console.log(ed);
          var message = ed.getContent();
          var due = $("#feedbackDeadline").val();

          $.ajax({
            url:'<?php echo getHostFQDN(); ?>util/createReviewRequests.php',
            data:{
              sendTo : sendTo,
              requestor : requestor,
              requirement_id : requirement_id,
              message : message,
              due : due
            }
          }).done(function(data){

          })          
        })

        /* Add tinymce to the message. */
        tinymce.init({
          selector:'#feedbackMesage',
          menubar:false,
          toolbar:"undo redo | bold italic | bullist numlist | link unlink",
          width:'100%',
          plugins: "link,mention",
          mentions:
          {
            delay: 100,
            source: function(query, process)
                {
                  //Do your ajax call
                  $.getJSON('/util/queryMention.php?q=2&pid=76&b=170', function(data) {
                    //call process to show the result
                    process(data)
                  })
                }
          },
        });

      });
      $("#modalRequestFeedback").modal();
    });

Open in new window

LVL 32
DrDamnitAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DrDamnitAuthor Commented:
Additional information:

After I click the button, then close the modal, then click it again, I get this in Firebug:
Selection-035.png
I also, as a test, removed the $("#modalRequestFeedback").on('show.bs.modal', function(e){ ... } section, and tested. The problem went away (of course the form becomes pointless at that point). But, the good news is: I've narrowed it down to that section of the code...
0
DrDamnitAuthor Commented:
OK, now I've narrowed it down to this line:
Selection-036.png
If I remove the datetimepicker(), it resolved the problem. So, the question not becomes: how do I fix the datetimepicker() in order to maintain its use?

Perhaps there are options I should use?
0
DrDamnitAuthor Commented:
Setting the date fixed it:
Selection-041.png
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.