stop label from toggling the input checkbox

后端 未结 5 1389
生来不讨喜
生来不讨喜 2021-01-17 09:34

I have the following html code. When clicking on the label it toggles the checkbox.

5条回答
  •  终归单人心
    2021-01-17 10:39

    "I have some logic that takes the id from the element "

    You could remove the for-attribute, if you store the ID somewhere else. For example in a data-*-attribute:

    On the other hand, it is sometimes difficult to point and click an a check-box based on the styling and the capabilities of the user. There is are good reasons for using the for-attribute.

提交回复
热议问题