My basic issue is that I have a click event that i have attach to my container, i am trying to delgate that click event just to the buttons in that container. All of that is easy, the issue i have is the event.target in webkit is hitting the spans in the button instead of the button its self. How do i stop the click event from bubbling down wards to the span in the button. I want my targ to be the butto. here is a quick demo showing the issue fiddle of the issue
I have no idea if it is possible to disable event bubbling is this case.
However in these cases I make a inverted event bubbling:
while(targ != null) {
if (targ.nodeName.toLowerCase() === 'button') {
alert(targ.nodeName.toLowerCase());
break;
}
targ = targ.parentElement;
}
Fiddle: http://jsfiddle.net/jVeMw/1/
Is not perfect for performance but since you are restricting the click event to the vidCommentBoard
div it should not be a problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.