Add attribute 'checked' on click jquery

前端 未结 5 2091
滥情空心
滥情空心 2020-12-30 00:49

I\'ve been trying to figure out how to add the attribute \"checked\" to a checkbox on click. The reason I want to do this is so if I check off a checkbox; I can have my loca

5条回答
  •  一向
    一向 (楼主)
    2020-12-30 01:10

    A simple answer is to add checked attributes within a checkbox:

    $('input[id='+$(this).attr("id")+']').attr("checked", "checked");

提交回复
热议问题