首页 > Web开发 > 详细

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

时间:2015-08-19 12:33:34      阅读:179      评论:0      收藏:0      [点我收藏+]

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);

 });

 

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

原文:http://www.cnblogs.com/colder/p/4741562.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!