Jquery Only Parent Click

Jquery Only Parent Click

Jquery ile sadece parent elemente tıklama eventı ekleme.

1
2
3
4
5
6
7
8
9
10
11
//Sadece Html elementine tıklandığında işlem yapar.
$('#outer').click(function(e) {
if (e.target === this){
console.log('Parent');
}
});

//Html elementinin kendisine tıklanmadıysa işlem yapmadan dön.
$('#outer').click(function(e) {
if(e.target != this) return;
});
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×