Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery to loop through table rows and cells, where checkob is checked, concatenate
    primarykey
    data
    text
    <p>I have a table with multiple rows. there are several columns in the table with checkboxes. I need to loop through each of the checkboxes, where it is checked concatenate/join the input from that particular cell to other inputs from the same row.</p> <p>you can see a fiddle here: <a href="http://jsfiddle.net/QS56z/10/">http://jsfiddle.net/QS56z/10/</a></p> <p>How can I, in addition to looping through the row, loop through each <code>&lt;td&gt;</code> once I have this <code>&lt;td&gt;</code> how can I look for an input whose name starts with <code>x</code> in that td. once found concatenate / join the input from that to the inputs in the row.</p> <p>I hope that makes sense.</p> <p>essentially: I want to join the (family) to the (size) to the (grade) where family and grade are on the same row, and there are several sizes on each row. each result must be written to the TD currently being processed.</p> <p>I have got up to this point but have got stuck:</p> <pre><code>function createcodes(){ alert('running'); //run through each row $('.authors-list tr').each(function(){ //processing this row //how to process each cell(table td) where there is checkbox $($(this).find('input[name^="line"]').val( $('$(this).find('input[name^="family"]'').val() + ' ' + // common input(family) on row, use for all table cells(td) $('#$(this).find('input[name^="size"]'').val() + ', ' + // this cells input called size, unique to this cell only $('#$(this).find('input[name^="grade"]'').val() // common input(grade) on row, use for all table cells(td) ); // end of cell row processing }); //end of rows processing } </code></pre> <p>Thanks as always. </p> <p><a href="http://jsfiddle.net/QS56z/10/">http://jsfiddle.net/QS56z/10/</a></p> <p>my html is:</p> <pre><code>&lt;table class="authors-list" border=1 id="ordertable"&gt; &lt;tr&gt; &lt;td &gt;&lt;input type="text" id="product1" name="product1" class="rounded" value="38114CR"&gt;&lt;/td&gt; &lt;td &gt;&lt;input type="text" size='5' id="qty1" name="qty1" class="rounded" value="10"/&gt;&lt;/td&gt; &lt;td class="tdcheckbox"&gt; &lt;input type="checkbox" id="h09_1" name="h09_1" checked class="rounded"/&gt; &lt;input type="text" id="line_1_09" name="line_1_09" &gt; &lt;input type="text" id="size_1_09" name="size_1_09" value="09"&gt; &lt;/td&gt; &lt;td class="tdcheckbox"&gt; &lt;input type="checkbox" id="h12_1" name="h12_1" class="rounded"/&gt; &lt;input type="text" id="line_1_12" name="line_1_12" value=""&gt; &lt;input type="text" id="size_1_12" name="size_1_12" value="12"&gt; &lt;/td&gt; &lt;td class="tdcheckbox"&gt; &lt;input type="checkbox" id="h15_1" name="h15_1" checked class="rounded"/&gt; &lt;input type="text" id="line_1_15" name="line_1_15" &gt; &lt;input type="text" id="size_1_15" name="size_1_15" value="15"&gt; &lt;/td&gt; &lt;td&gt;&lt;input type="text" name="cubespercheck_1" id="cubespercheck_1" value="0" size=5&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="skufamily_1" id="skufamily_1" value="38114"&gt;&lt;/td&gt; &lt;td&gt;&lt;input type="text" name="skugrade_1" id="skugrade_1" value="cr"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input type="button" id="continue" value="continue"&gt; </code></pre> <p>keep in mind there are multiple rows. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload