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

if(dataBack.remind){     $("#isremind").prop("checked",true); }else{     $("#isremind").removeAttr("checked"); }

添加的时候用prop,取消用removeAttr。


<二>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

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
  • 2021-10-16
  • 2021-11-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-10-09
  • 2022-12-23
相关资源
相似解决方案