My HTML structure looks something like below:
<div id="mainDiv">
<table></table>
<table></table>
<table>
<tr>
<td id="first">FirstCell</td><td id="second">SecondCell</td>
</tr>
<tr>
<td></td><td></td>
</tr>
</table>
</div>
Now I would like the find the content of second td based on the value of first td.
I have tried following but didn't seem to work.
$("#mainDiv tr td:contains('first')").each(function(){
var secondCell = $(this).find('#second').value();
});
Any help will be highly appreciated.