今天寫了一個滑鼠移入與點擊時觸發的選單,裡面放了幾個按鈕,發現按鈕的mouseenter事件,會連帶觸發容器的mouseenter事件
找了一下發現可以用以下方式來避免
$(document).ready(function(){
$(".header").click(function(){
$(this).children(".children").toggle();
});
$(".header a").click(function(e) {
e.stopPropagation();
});
});