I click the link in the table cell. I need to get the value of a specific cell inside the same row of the table.
<tr> <td class="one">this</td> <td class="two">that</td> <td class="three">here</td> <td class="four"><a href="#">there</a></td> </tr> <tr> <td class="one">qwqw</td> <td class="two">dfgh</td> <td class="three">ui</td> <td class="four"><a href="#">there</a></td> </tr>
I have a click handler attached to a link in the fourth cell. This click handler calls a function that opens a modal window. When a form is submitted in modal format, I also want to pass the value of td class = "two" from the line to which the link to this modal was clicked.
Here is the function that sends the modal (the problem area gets the correct value for var Something):
var Send = function() { var Name = $( '#name' ).val(); var Something = $(this).closest('td').siblings('.two').text();
The problem is that I cannot get the correct value for Something. This should be the value of td class = two on the same line as the click.
How it all happens together. Click the destination link that calls the Send_Click () method. Send_Click does some checks and then calls Send (), but the value for Something is never populated. Is it because this not what I think so? Hjelp!
jquery jquery-selectors
Stuart Feb 23 '10 at 1:40 2010-02-23 01:40
source share