Firefox下button按钮有子元素canvas 给canvas 绑定click事件, 点击无效,这是什么原因?把button标签换成div就可以了。测试代码如下:
<body>
<button>
<canvas id="cav" style="width: 100px; height: 100px; border: 1px solid #000;">不支持</canvas>
</button>
</body>
<script>
var a = document.getElementById('cav');
a.onclick = function() {
console.log('aaa'); // Firefox / IE9+ 点击无效
}
</script>