In Safari click event not fired on button with svg element. When you click on buttons edge click event fires, but if you click on svg element itself does not.
$(document).on('click', 'button', function(e) {
console.log(e);
});
It works if I attach click event like this:
$('button').on('click', function(e) {
console.log(e);
});
Because of buttons added dynamically I can't do like this;
Example in codepen.io http://codepen.io/neilhem/pen/bdGYPq
jQuery version 2.1.3
答案 0 :(得分:25)
我不知道这是解决此问题的最佳方法,但是将pointer-events: none;
添加到svg元素解决了问题。
svg.icon {
pointer-events: none;
}
答案 1 :(得分:0)
svg {
pointer-events: none;
}
对此有什么更好的解决方案?我经常遇到这种情况。
这对我有用。