Reputation: 164
How do I select the radio from a list of tr's where the only unique element is 'Some unique value'?
<tr>
<td>
<input type="radio" name="myradioname" value="4" onclick="myevent">
</td>
<td>
Some value
</td>
<td>Some unique value</td>
</tr>
Upvotes: 0
Views: 65
Reputation: 15376
While this cannot be done using pure CSS, it can be achieved using jQuery's :contains
selector..
The selector you're looking for is:
$("tr:contains('Some unique value')").find('input[type="radio"]')
First you look for a <tr>
that contains 'Some unique value', then you find input[type="radio"]
within it.
Works like a charm. In the jsFiddle only the radio near 'Some unique value' gets checked on page load using this selector.
Notes:
<td>
that contains 'Some unique value' then looking for the <input>
inside its siblings.. However I think the way presented here is most efficient.$("#myTable tr:contains('Some unique value')").find('input[type="radio"]')
.<tr>
for example class="special"
then adding a CSS rule like so: .special input[type="radio"]{...}
Upvotes: 3