码迷,mamicode.com
首页 > 其他好文 > 详细

radio与checkbox的选中事件

时间:2015-04-13 16:22:41      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:

<一>判断checkbox的选中事件
var result=$(this).find("input[type=‘checkbox‘]").prop("checked");
result 是bool类型的值 true是选中的状态 false是没选中的状态
<二>radio的选中状态

    //付款方式
    $(div#pay-type input[type="radio"] ).each(function (e) {
        var radiotype = $(this).attr("checked");
        if (radiotype == "checked") {
            paytype = $(this).attr("tid");
        }
    });


   var radiotype = $(this).attr("checked");
如果radiotype == "checked" 就是选中

find就相当与children  
closet就相当于parent

 

radio与checkbox的选中事件

标签:

原文地址:http://www.cnblogs.com/xiaoyaodijun/p/4422114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!