How do I select all check box when I click on Select button using jQuery

前端 未结 9 982
遇见更好的自我
遇见更好的自我 2020-12-21 20:22

I have HTML page which have multiple check boxes and individually they can be checked. I have button select, so what I am suppose to do is. When I click on sel

9条回答
  •  情深已故
    2020-12-21 20:31

    inside the "click" function "this" is button and not a checkbox. and button property checked is underfined. "$('.btn-chk').each" - is loop on each element with class ".btn-chk", in your HTML is buttons and not an checkboxes.

    in your context the "#selectAll" must be a checkbox and put class '.btn-chk' on your checkboxes

提交回复
热议问题