Front-end event bubbling (such as one click onclick event executes twice) solution

Summary question:

When I use antd the radio component when the component is found to radio bug it is that you can not give him given id and value, but also does not bind the onclick and other events.
for example:

clipboard.png

Even if you can see and value id given front page rendering is not normal to assign value no matter what the result is on
but I still need him for some operations need to bind his onclick event so I have a solution that is in radio coat with a layer of label bound div id attribute, while the onclick event binding on this layer div. When we trigger it, find internal radio by jQuery child selector. But to do so again the problem is the subject of this article event bubbling
Simply put, because when click on label, will trigger a click event set inside the input, resulting in an event again triggers
the solution is:

 $("label").click(function (e) {
     if ($(e.target).is("input"))
     return;
});

2018-2-28 day more:
in fact, should solve the problem of ideas, bubbling when the event occurred, whether we can cause these two issues separate into two div dom node for processing, rather than control by js .
Reference links: HTTP: //blog.csdn.net/qazwsx33 ...

Guess you like

Origin www.cnblogs.com/baimeishaoxia/p/12193767.html