我有下面的代码。我希望当我运行它时,它会显示里面写有“是”的行,但它会显示最后一个(“正在进行中”)。为什么?
<input type="radio" name="negotiation" value="0" checked="checked">Yes
<input type="radio" name="negotiation" value="1">No
<input type="radio" name="negotiation" value="2">On process
<table>
<tr class="answer_yes"><td>Yes</td></tr>
<tr class="answer_no" ><td>No</td></tr>
<tr class="answer_on_process"><td>On process</td></tr>
</table>
<script type="text/javascript">
$('input[name=negotiation]').change(function(){
$('tr').hide();
if($(this).val() == '0')
{
$('.answer_yes').show();
}
else if($(this).val() == '1')
{
$('.answer_no').show();
}
else if($(this).val() == '2')
{
$('.answer_on_process').show();
}
}).change();
</script>