title: JQuery .click() not working on appended <tr> from ajax
body: <p>I have a table where the table rows are being .appended through my ajax return.</p>
  
  <p>The Ajax call/return</p>
  
  <pre><code>$("#searchButton").click(function(){
      var lastName = $('#lastName').val();
      var data = {
        action: 'mysearch',
        post_lastName: lastName
      };
      $.post(
          the_ajax_script.ajaxurl,
          data,
          function(response)
          {
              $("#searchResults").append(response);
          }
      );
      return false;
  });
  </code></pre>
  
  <p>HTML file where the search results appear</p>
  
  <pre><code>&lt;div class="retained intake_content"&gt;
          &lt;table id="searchResults" style="width:80%"&gt;
  
          &lt;/table&gt;
  &lt;/div&gt;
          &lt;style&gt;
              #searchResults tr:hover {
                  background-color: orange;
                  cursor: pointer;
              }
          &lt;/style&gt;
  </code></pre>
  
  <p>And my php for retrieving the info from SQL and echoing the created table row.</p>
  
  <pre><code>while($row = $stmt -&gt;fetch(PDO::FETCH_ASSOC)){
          $firstName = $row['first_name'];
          $lastName = $row['last_name'];
          $id = $row['id'];
  
          echo '&lt;tr&gt;&lt;td&gt;' . $firstName .'&lt;/td&gt;&lt;td&gt;' . $lastName . '&lt;/td&gt;&lt;td&gt;' . $id .'&lt;/td&gt;&lt;td&gt;&lt;button type="button" id="personid" name="rowId" value="' . $id  . '"&gt; View&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;';
      }
  </code></pre>
  
  <p>My test to see if the button was clicked.</p>
  
  <pre><code>$("#personid").click(function(){
  
      //var id =$(this).val();
      console.log("Clicked");
      alert('Row has been clicked');
  });
  </code></pre>
  
  <p>I added a button with the id of rowsid with the intention of using JQuery .click() event to send the ID to another ajax call to retrieve more detailed information. The problem is I can not get the JQuery .click() to alert at all. I then tried if console.log would work and it did not.</p>
  
  <p>So I am guessing .append() has alot to do with this issue or the way I echoed the table? Any help would be greatly appreciated. </p>
  
  <p>BTW this is in a wordpress plugin...</p>