火狐下button标签子元素无法点击
button下元素点击事件:在chrome和safari下每个a标签可以点击,在火狐下a标签无法点击。
<button>
<a href="javascript:;" id="click1">adsf</a>
<a href="javascript:;" id="click2">1231</a>
</button>
<script>
/* 主要注意:
button下元素点击事件:
在chrome和safari下每个a标签可以点击,
在火狐下a标签无法点击
*/
click1.onclick = function(e){
console.log(e);
e.stopPropagation();
e.preventDefault();
alert('adsf')
}
click2.onclick = function(e){
e.stopPropagation();
e.preventDefault();
alert('1231')
}
</script>
浙公网安备 33010602011771号