Reputation: 47605
I have a bunch of table rows with radio inputs:
<tr>
<td>
<input name="myRadio" type="radio" value="1">
</td>
</tr>
Q: How do hide all the rows that are not this row when it is selected?
$('input').filter(':radio').change(function() {
$('tr').find(not this).hide();
});
Upvotes: 2
Views: 213
Reputation: 1667
$('input').filter(':radio').change(function() {
$('tr, input:not(:checked)').hide();
});
Upvotes: 1
Reputation: 382696
Try:
$('input').filter(':radio').change(function() {
$(this).closest('tr').siblings('tr').hide();
});
Upvotes: 2
Reputation: 25776
$('input').filter(':radio').change(function() {
$('tr').not( $(this).closest('tr') ).hide();
});
Upvotes: 1