龙岩易富通网络科技有限公司

龙岩小程序开发,龙岩分销系统

jquery checkbox属性checked="checked"已有,但却不显示打勾的解决办法

2016.05.13 | 1591阅读 | 0条评论 | javascript

jquery去除checked

  $("input[name='payment_id']").each(function(index){

    $("input[name=payment_id]").eq(index).removeAttr("checked");

    });

   

jquery选中checked

    $("input[name='payment_id']").each(function(index){

    if ($(this).val() == payid) {

    $("input[name=payment_id]").eq(index).prop("checked",'checked');

    }

    });


注意:选中这里需要用prop,如果用attr已选但却不显示打勾。

赞 (

发表评论