title: How to retrieve data from <td> within the same <tr> and output data to external div
body: <p>I have a table of data consisting of 3 columns. In the third column is a button to click which should add data to the external div with the id of routeList from the first p in the second column. Here is my html. As well I have added a click event to change the class of the button and change the button text. </p>
  
  <p>.html</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td class="col1"&gt;&lt;img src="http://placehold.it/200x200" alt="..." class="img-responsive tableImage"&gt;&lt;/td&gt;
      &lt;td class="col2"&gt;
          &lt;p class="address"&gt;
              &lt;i class="fa fa-home fa-lg"&gt;&lt;/i&gt; Address
          &lt;/p&gt;
          &lt;p&gt;
              &lt;i class="fa fa-calendar fa-lg"&gt;&lt;/i&gt; Dates
          &lt;/p&gt;
          &lt;p&gt;
              &lt;i class="fa fa-map-marker fa-lg"&gt;&lt;/i&gt; Distance
          &lt;/p&gt;
      &lt;/td&gt;
      &lt;td class="col3"&gt;
          &lt;button type="button" class="btn btn-sm routeAdd btn-success" data-toggle="addToRoute"&gt;&lt;i class="fa fa-check"&gt;&lt;/i&gt; Added&lt;/button&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>.js</p>
  
  <pre><code>$('[data-toggle=addToRoute]').click(function() {
      if($(this).children().hasClass('fa-plus')) {
          $(this).removeClass('btn-custom').addClass('btn-success').empty().html('&lt;i class="fa fa-check"&gt;&lt;/i&gt; Added');
              } else {
          $(this).removeClass('btn-success').addClass('btn-custom').empty().html('&lt;i class="fa fa-plus"&gt;&lt;/i&gt; Add');
              }
          });
  </code></pre>
  
  <p>I was trying to add this to the first section of the if statement</p>
  
  <pre><code>$(this).closest('p.address').appendTo('#routeList');
  </code></pre>
  
  <p>I think I am missing something simple. As well on the flip side of the else statement the p should be removed if the button is clicked. Am I not selecting the element correctly. Or I am attacking this completely wrong.</p>