title: How to get all the td values of a Table in a javascript function
body: <p>I have a datatable in which i am showing child rows expand collapse functionality.It is working well but i want to get the contents of last td of a table.For now i have create a function which is placing some hard coded value in the datatable expanded place . In that place i want to get those td values. !</p>
  
  <p><img src="https://i.stack.imgur.com/WjcZ9.png" alt="enter image description here"></p>
  
  <p>Here is the code i am posting </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.5/css/jquery.dataTables.css"&gt;
  &lt;link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/responsive/1.0.4/css/dataTables.responsive.css"&gt;
  
  
  &lt;script type="text/javascript" language="javascript" src="https://code.jquery.com/jquery-1.11.1.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" language="javascript" src="https://cdn.datatables.net/1.10.5/js/jquery.dataTables.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" language="javascript" src="https://cdn.datatables.net/responsive/1.0.4/js/dataTables.responsive.min.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;style type="text/css"&gt;
  td.details-control {
  background:     url('http://www.datatables.net/examples/resources/details_open.png') no-repeat     center center;
   cursor: pointer;
    }
  tr.shown td.details-control {
  background:   url('http://www.datatables.net/examples/resources/details_close.png') no-repeat    center center;
   }
  &lt;/style&gt;
  &lt;script type="text/javascript" class="init"&gt;
    /* Formatting function for row details - modify as you need */
     function format ( d ) {
  
      var v;
  
          $("#example tbody tr").each(function() {
  
          // Within tr we find the last td child element and get content
          v = $(this).find("td:last-child").html();
          return v;
          });
  
      // Within tr we find the last td child element and get content
      //alert($(this).find("td:last-child").html());
  
  
      return '&lt;fieldset&gt; &lt;legend&gt;     &lt;/legend&gt;   &lt;table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;"&gt;'+
      '&lt;tr&gt;'+ 
      '&lt;td&gt;'+v+'&lt;/td&gt;'
     '&lt;/tr&gt;'
  
      '&lt;/table&gt; &lt;/fieldset&gt;' 
  
  
    }
    $(document).ready(function() {
      var table = $('#example').DataTable();
     // Add event listener for opening and closing details
      $('#example tbody ').on('click', 'td.details-control', function () {
      var tr = $(this).closest('tr');
      var row = table.row( tr );
  
  if ( row.child.isShown() ) {
      // This row is already open - close it
      row.child.hide();
      tr.removeClass('shown');
  }
  else {
      // Open this row
      console.log(row);
      row.child( format(row.data()) ).show();
      tr.addClass('shown');
     }
    } );
    // End add event 
  
   $("#divPopUp").dialog({
      resizable: true,
     autoOpen: false,
     width: 550,
     modal: true,
     buttons: {
      "Save": function() {
          var text = $(this).find( ":checkbox:checked" ).map(function() {
              return this.value+' ';
          }).get().join();
  
          var obj = $(this).data("opener");
          $(obj).parents('td:first').siblings(':eq(2)').find(':text').val(text);
          $( this ).dialog( "close" );
      },
      Cancel: function() {
          $( this ).dialog( "close" );
      }
  },
  close:function(){
      $(this).find( ":checkbox" ).removeAttr('checked');
      $( this ).dialog( "close" );
  }
  });
  
  $('button.btn').on('click', function(){
  var title = $(this).parents('td:first').siblings(':eq(0)').text();
  console.log("title is : "  + title);
  $( "#divPopUp" ).data('opener', this).dialog( "option", "title", title    ).dialog( "open" );
        var text =          $(this).parents('td:first').siblings(':eq(2)').find(':input').val();
  if($.trim(text) != ''){
        var texts = text.split(" ,"); 
      $.each(texts, function(i, value){    $("#divPopUp").find(':checkbox[value="'+$.trim(value)+'"]').prop('checked', true);
         });
       }
     });
   } );
     &lt;/script&gt;
     &lt;body&gt;
       &lt;table id="example" class="display" cellspacing="0" width="100%"&gt;
          &lt;thead&gt;
             &lt;tr&gt;
                &lt;th&gt;&lt;/th&gt;
               &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Position&lt;/th&gt;
              &lt;th&gt;Office&lt;/th&gt;
             &lt;th&gt;Age&lt;/th&gt;
             &lt;th&gt;Start date&lt;/th&gt;
            &lt;th&gt;Salary&lt;/th&gt;
  
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
         &lt;td class="details-control" &gt;&lt;/td&gt;       
          &lt;td&gt;Tiger Nixon&lt;/td&gt;
          &lt;td&gt;System Architect&lt;/td&gt;
          &lt;td&gt;Edinburgh&lt;/td&gt;
          &lt;td&gt;61&lt;/td&gt;
          &lt;td&gt;2011/04/25&lt;/td&gt;
          &lt;td&gt;$320,800&lt;/td&gt;
  
  
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
           &lt;td class="details-control" &gt;&lt;/td&gt;
          &lt;td&gt;Garrett Winters&lt;/td&gt;
          &lt;td&gt;Accountant&lt;/td&gt;
          &lt;td&gt;Tokyo&lt;/td&gt;
          &lt;td&gt;63&lt;/td&gt;
          &lt;td&gt;2011/07/25&lt;/td&gt;
          &lt;td&gt;$170,750&lt;/td&gt;
  
  
      &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
           &lt;td class="details-control" &gt;&lt;/td&gt;
          &lt;td&gt;Ashton Cox&lt;/td&gt;
          &lt;td&gt;Junior Technical Author&lt;/td&gt;
          &lt;td&gt;San Francisco&lt;/td&gt;
          &lt;td&gt;66&lt;/td&gt;
          &lt;td&gt;2009/01/12&lt;/td&gt;
          &lt;td&gt;$86,000&lt;/td&gt;    
      &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;/table&gt;
  </code></pre>
  
  <p>Inside that format function i want to get all td values of datatables.Somebody please help</p>