JQuery: Hide a Div When User Clicks Outside of It

January 17, 2019

In this Tutorial, We are learning How to hide a div When user clicks outside of it. Hide element on click outside is must used for the Menu.

This code snippet demonstrates. How to track if a click is being made outside of an element. In this Example When User Click outside of image then image is hide. When User Click on the image. Image is Not hide. You can use same as Menu.

Syntax & Code

The Following Example is Hide a DIV when user clicks outside of it in Jquery.

When You click outside of Image image is hide. You can track easily When user click outside Custom Div.

Hope This Help.

Karan Suthar

Surat, India

I'm Karan, the creator Behind the KTechBlog. I write Blogs in my Free Time. I ❤ to learn new Technologies and Share with Others. I'm Trying best effort to make KTechBlog useful for Everyone.