Prevent on click on parent when clicking button inside div

前端 未结 5 1841
悲哀的现实
悲哀的现实 2020-12-29 02:03

Is it possible to prevent the function on the

element from running when clicking the button inside the div?

When clicking the button element

5条回答
  •  离开以前
    2020-12-29 02:45

    additionally, if a child element detains you from clicking the parent element, you can fix this by adding CSS to the child element pointer-events: none. this solution is valid if there is no event in the child element.

提交回复
热议问题