title: Bootstrap button not working in table
body: <p>I have a simple bootstrap ToDo app that I am creating and I am having issues with some of the buttons. I have a button up top that adds a task, using jQuery and PHP. This button works as expected. Once the task is add, the table underneath updates and displays all of the tasks. On the right side of the tasks is a Delete button and this is the button that is giving me issues. Here is the code for that button:</p>
  
  <p>HTML</p>
  
  <pre><code>&lt;div class="container"&gt;
          &lt;div class="row"&gt;
              &lt;div class="col-lg-8 col-lg-offset-2 col-md-8 col-md-offset-2 col-sm-8 col-sm-offset-2 col-xs-10 col-xs-offset-1"&gt;
                 &lt;table id="taskHolder" class="table table-striped"&gt;
                    &lt;!-- THIS IS WHERE THE OUTPUT GOES --&gt;
                 &lt;/table&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>JS - Look at the bottom portion to see what is not working. The <code>$('.btn.danger')</code> part.</p>
  
  <pre><code>$(document).ready(function(){
      'use strict';
      $('#taskHolder').load('php/updateTasks.php');
      $('.failed').hide();
      $('.success').hide();
      $('#add').click(function(){
          var singleItem = $('#task').val();
          var dataString = 'task='+ singleItem;
          $('.failed').hide();
          $('.success').hide();
  
          $('.alert').hide();
  
          if(singleItem === ''){
              $('.failed').fadeIn(200).show();
              $('#task').focus();
              return false;
          } else {
              $.ajax({
                  type: 'POST',
                  url: 'php/addTask.php',
                  data: dataString,
                  success: function() {
                      $('.success').fadeIn(200).show();
                      $('#task').val('');
                      $('#taskHolder').load('php/updateTasks.php');
                  }
              });
              return false;
          }
      });
      $('.btn-danger').click(function(){ //THIS IS WHERE I AM HAVING ISSUES
  
          var alert = alert('Hello there!');
          var console = console.log('Hello there!');
  
          return alert, console;
  
      });
  });
  </code></pre>
  
  <p>PHP - This is what produces the table results. This is not a live production, so please ignore the MySQL lack of security ;)</p>
  
  <pre><code>&lt;?php
      $con = mysqli_connect("localhost","root","root","todo");
  
      if (mysqli_connect_errno()) {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
      $searchTasks = "SELECT * FROM tasks WHERE state=1 ORDER BY date DESC";
      $results = mysqli_query($con,$searchTasks);
      $row = '';  
      while($row = mysqli_fetch_array($results)) {
          echo '&lt;tr&gt;&lt;td&gt;'.$row['list'].'&lt;/td&gt;&lt;td&gt;&lt;button name="deleteTask" type="submit" class="deleteTask btn btn-danger pull-right" data-id="'.$row['key'].'"&gt;Delete&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;';
      }
      mysqli_close($con);
  ?&gt;
  </code></pre>
  
  <p>I tried using <code>.btn-primary</code> instead of the <code>.btn-danger</code> and it rendered the same results. I noticed that if I put the <code>&lt;form&gt;</code> tags around the whole table, the button refreshes the page when I press it, but there is still no <code>console.log</code> or <code>alert</code>. Plus, I am thinking that since I am using a jQuery click event, I should not have to have <code>&lt;form&gt;</code> tags around the table.</p>
  
  <p>Any help that you can afford would be greatly appreciated.</p>