javascript - Listen for click on div, but not when any of its children are clicked -


I am trying to hide the div and its children when the div gets clicked, but not when any event To any of its children; Like, swipe, tap or click.

jQuery that hides Div on the click is simple:

  $ ("# tabs"). Click (function () {$ (this). FadeOut ();});   

But I have found that when these children are clicked or swiped, the div flashes.

How can I get lost due to these incidents on my children, but it's only allowed to click fade for myself?

Check that the element was clicked to force the same element: < Pre> $ ("# tab"). Click (function (e) {if (e.target == this) $ (this). FadeOut ();});

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -