如果我有一个绝对定位的父div,然后是一个具有更高z-index且相对定位的子div,有没有办法只在单击父div时才有一个click事件寄存器,而不是内部div ?
解决方法
- $(".parent").click(function(e) {
- if (e.target == this) {
- $(this).hide();
- }
- });
- $(".parent").click(function(e) {
- if (e.target == this) {
- $(this).hide();
- }
- });