Click a div to check / uncheck a checkbox

前端 未结 5 667
执念已碎
执念已碎 2020-12-11 19:13

I applied the following code to make table rows check/uncheck a child checkbox when clicked. Now I discovered that when clicking the checkbox itself inside the row it doesen

5条回答
  •  囚心锁ツ
    2020-12-11 19:55

    Besides the given solutions, isn't it better to just set the checkbox to the oposite state? For example:

    var _current_state = checkbox.attr("checked");
    checkbox.attr("checked") = !_current_state;
    

提交回复
热议问题