2013-09-23 195 views

回答

2

event對象的.target property會給你啓動該事件的DOM元素:

$("#area").click(function(e) { 
    if (e.target.id != "forbidden") { 
     // do something 
    } 
}); 
+0

謝謝你的隊友!有用。 – user2783842

0

另一種方法是禁元素上使用的stopPropagation