JQUERY get data from <td> and <input> tag for every row and output on single line
<p>Sorry, I am really green when it comes to JQUERY. I have the following html code, that basically makes a table with text using  and  checkboxes.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript" src="table2CSV.js" &gt; &lt;/script&gt;
&lt;script&gt;
function getCSVData()
{
     var csv_value=$('#tblGrid').table2CSV({delivery:'value'});
     $("#csv_text").val(csv_value);
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table&gt;
   &lt;tr&gt;
     &lt;td class="cellText"&gt;HB DIOCD - AR3 HT&lt;/td&gt;
       &lt;td width="60" align="center"&gt;
          &lt;input class="chText" type="checkbox" checked="checked" value="X" name="options" /&gt;
     &lt;/td&gt;
        &lt;td width="60" align="center"&gt;
           &lt;input class="chText" type="checkbox" checked="checked" value="X" name="options" /&gt;
      &lt;/td&gt;
      &lt;td width="60" align="center"&gt;
         &lt;input class="chText" type="checkbox"  name="options"/&gt;
      &lt;/td&gt;
   &lt;/tr&gt;
&lt;/table&gt; 
&lt;form action="getCSV.php" method ="post" &gt;
&lt;input type="hidden" name="csv_text" id="csv_text"&gt;
&lt;input type="submit" value="Save Configuration" onclick="getCSVData()"&gt;&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The jquery code is next (found this code on the web,KunalBabre.com - table2CSV). It does a very good job when there is just text:</p>

<pre><code>jQuery.fn.table2CSV = function(options) {
    var options = jQuery.extend({
        separator: ',',
        header: [],
        delivery: 'popup' // popup, value
    },
    options);

    var csvData = [];
    var headerArr = [];
    var el = this;

    //header
    var numCols = options.header.length;
    var tmpRow = []; // construct header avalible array

    if (numCols &gt; 0) {
        for (var i = 0; i &lt; numCols; i++) {

           tmpRow[tmpRow.length] = formatData(options.header[i]);
        }
    } else {
        $(el).filter(':visible').find('th').each(function() {
            if ($(this).css('display') != 'none') tmpRow[tmpRow.length] = formatData($(this).html());
        });
    }

   row2CSV(tmpRow);
    // actual data   
    $(el).find('tr').each(function() 
     {
        var tmpRow = [];
        var valArray=[];
        $(this).filter(':visible').find('td').each(function()
        {   
             if ($(this).css('display') != 'none') tmpRow[tmpRow.length] = formatData($(this).html());
   });        
       //alert(tmpRow);
       row2CSV(tmpRow);
   });
   if (options.delivery == 'popup') {
       var mydata = csvData.join('\n');
       return popup(mydata);
   } else {
       var mydata = csvData.join('\n');
       return mydata;
   }

    function row2CSV(tmpRow) {
        var tmp = tmpRow.join('') // to remove any blank rows
        // alert(tmp);
       if (tmpRow.length &gt; 0 &amp;&amp; tmp != '') {
           var mystr = tmpRow.join(options.separator);
           csvData[csvData.length] = mystr;
      }
  }
   function formatData(input) {
      // replace " with “
      var regexp = new RegExp(/["]/g);
      var output = input.replace(regexp, "“");
      //HTML
      var regexp = new RegExp(/\&lt;[^\&lt;]+\&gt;/g);
          var output = output.replace(regexp, "");
       if (output == "") return '';
       return '"' + output + '"';
  }
  function popup(data) {
      var generator = window.open('', 'csv', 'height=400,width=600');
       generator.document.write('&lt;html&gt;&lt;head&gt;&lt;title&gt;CSV&lt;/title&gt;');
       generator.document.write('&lt;/head&gt;&lt;body &gt;');
       generator.document.write('&lt;textArea cols=70 rows=15 wrap="off" &gt;');
       generator.document.write(data);
       generator.document.write('&lt;/textArea&gt;');
       generator.document.write('&lt;/body&gt;&lt;/html&gt;');
       generator.document.close();
       return true;
    }
};
</code></pre>

<p>The code when executed returns the data inside the  tag, but not the values inside of the  tag.</p>

<p>Here is a sample of the output:
"HB DIOCD - AR3 HT",,,</p>

<p>What I would like is:
"HB DIOCD - AR3 HT",X,X,</p>

<p>in the actual data portion of the script, I was successful getting the individual values from the input checkboxes, however I do not know how to get the  text concatenated with the  values. </p>

<p>Thanks for any help,</p>

<p>CPAZ</p>
