Jquery点击表格单位时选中其中的Radio的三个方法

HTML:

<table>
   <tr>
    <td>
     1<br>
     <input type="radio" name="choice" value="1">
    </td>
    <td>
     2<br>
     <input type="radio" name="choice" value="2">
    </td>
    <td>
     3<br>
     <input type="radio" name="choice" value="3">
    </td>
   </tr>
  </table>

Jquery:

$("td").click(function () {
   $('input:radio', this).attr('checked', true);
});

$("td").click(function () {
   $(this).find('input:radio').attr('checked', true);
});

$("td").click(function () {

  $(this).closest('input:radio').attr('checked',true);

 });
原文地址:https://www.cnblogs.com/colder/p/4741562.html