carpinteyrogwo
New Member
I need to find the table header and 1st element in the row inside an onclick function using jquery,\[code\]$(document).ready(function(){$(".items").delegate("tr", "dblclick", function(data){ alert(data.target.innerHTML); alert($(this).find('td:eq(0)').html());});});\[/code\]the below code is giving me the inner html and the 1st element in the selected row. I need to get the table header also corresponding to the cell which i have clicked.I have tried by putting the below code inside thedblclick function, but I think the index passed is wrong, how can I get the correct index?\[code\]var headerValue= http://stackoverflow.com/questions/14572916/$(this).closest("table").find('th').eq($(this).index()); alert(headerValue.text());\[/code\]html table:\[code\]<table class="items"><thead><tr><th id="sku-grid_c1">Name</th><th id="sku-grid_c2">Active</th><th id="sku-grid_c3">Date Created</th><th id="sku-grid_c4">Date Updated</th><th id="sku-grid_c5">Code</th><th id="sku-grid_c6">Price</th><th id="sku-grid_c7">Shipping</th><th id="sku-grid_c8">Max Qty</th><th class="button-column" id="sku-grid_c9"> </th></tr></thead><tbody><tr class="odd"><td>fbdh</td><td>yes</td><td> </td><td> </td><td>t67r6r7t6t</td><td>23</td><td>12</td><td>12</td></tr><tr class="even"><td>bfhewfbuh</td><td>yes</td><td> </td><td> </td><td>678ty78tg</td><td>56</td><td>7</td><td>6</td></tr><tr class="odd"><td>cdbj</td><td>no</td><td> </td><td> </td><td> hudhqu</td><td>12</td><td>12</td><td>1</td></tr><tr class="even"><td>guyguyf</td><td>yes</td><td> </td><td> </td><td>678gy8t</td><td>56</td><td>56</td><td>6</td></tr></tbody></table>\[/code\]