lilbiscuit lilbiscuit - 1 year ago 114
jQuery Question

How to select td when you know th text with jquery

I have a table containing rows with exactly one th and one td like this:

<th>Phone Number</th>

I need to select the td cell (and replace the html) by using the th text "Phone Number". I can get the th cell with

$('th:contains("Phone Number")')

but I can't figure out how to select the corresponding td cell.

Answer Source
$('th:contains("Phone Number")').next('td');
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download