I am having problems getting table data in a row if a button is selected. I have two buttons that approve and reject, and based on which buttons the user clicks, I want to capture data using a query. can get line numbers and stuff, not line data. I need to get id and tester.
that's what i
<table id="mytable" width="100%"> <thead> <tr> <th>ID</th> <th>Tester</th> <th>Date</th> <th>Approve</th> <th>Deny</th> </tr> </thead> <tbody> <tr class="test"> <td class="ids">11565 </td> <td class="tester">james</td> <td>2012-07-02 </td> <td><Button id="Approved" type="submit" >Approved</button> </td> <td><Button id="deny_0" type="submit" >Denied</button> </td> </tr> </tbody> </table>
here is my javascript to get the tr and td number, but I'm not sure how to use it to get what I need
$(document).ready(function() { $('td').click(function(){ var col = $(this).parent().children().index($(this)); var row = $(this).parent().parent().children().index($(this).parent()); alert('Row: ' + row + ', Column: ' + col);
source share