$country.parent().parent().next().children('td').children('.province-select')
Basically I have some HTML that looks like this:
<table>
<tr>
<th>country</th>
<td><select name="country"/></td>
</tr>
<tr>
<th>province</th>
<td><select class="province-select"/></td>
</tr>
</table>
Once I've nabbed the country select, I need to find the next .province-select. Would be nice if it's little more robust to subtle HTML changes.
AFAIK next() only finds siblings, and closest() only traverses up the DOM tree.
I have a few of these all in the same table. That's why I'm using all this parent/next garbage. I don't want to use IDs because... well, then the script will only work on one specific country/province pair; I need it to run on all of them; thus I need to find the corresponding province field for the country field.