ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Close Hide DIV when Clicking outside in jQuery<p>Hi <a class="username" rel="chetan">chetan</a>,</p> <p>Check the below sample code.</p> <p><strong><span style="text-decoration: underline;">HTML</span></strong></p> <div class="demo_block"> <pre class="brush: html">&lt;div id=&#34;div1&#34; style=&#34;display: none;&#34;&gt; &lt;input id=&#34;txtKeyword&#34; name=&#34;keyword&#34; type=&#34;text&#34; /&gt; &lt;input id=&#34;txtCategory&#34; name=&#34;search&#34; type=&#34;text&#34; /&gt; &lt;/div&gt; &lt;input id=&#34;btnGo&#34; type=&#34;button&#34; name=&#34;button&#34; value=&#34;Go&#34; /&gt; &lt;script type=&#34;text/javascript&#34; src=&#34;https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js&#34;&gt;&lt;/script&gt; &lt;script type=&#34;text/javascript&#34;&gt; $(function () { $(&#34;[id*=btnGo]&#34;).click(function (e) { $(&#34;[id*=div1]&#34;).attr(&#39;style&#39;, &#39;display:block&#39;); }); $(document).click(function (e) { if (!$(e.target).is(&#39;[id*=btnGo]&#39;)) { $(&#34;[id*=div1]&#34;).attr(&#39;style&#39;, &#39;display:none&#39;); } }); }); &lt;/script&gt;</pre> </div> <p><a class="demo button orange btn btn-red">Demo</a></p>https://www.aspforums.net:443/Threads/199779/Close-Hide-DIV-when-Clicking-outside-in-jQuery/https://www.aspforums.net:443/Threads/199779/Close-Hide-DIV-when-Clicking-outside-in-jQuery/Fri, 12 Oct 2018 00:50:53 GMTClose Hide DIV when Clicking outside in jQuery<p>Hi sir...This Worked for me:</p> <p>&nbsp;</p> <pre class="brush: js"> $(document).click(function (e) { if (e.target != $(&#34;.sb-icon-search&#34;)[0] &amp;&amp; (e.target.parentElement.parentElement != $(&#34;.header-form-container&#34;)[0])) { $(&#34;.header-search-body&#34;)[0].style.display = &#39;none&#39;; } }); $(&#34;.header_search&#34;).click(function (e) { $(&#34;.header-search-body&#34;)[0].style.display = &#39;block&#39;; });</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/199779/Close-Hide-DIV-when-Clicking-outside-in-jQuery/https://www.aspforums.net:443/Threads/199779/Close-Hide-DIV-when-Clicking-outside-in-jQuery/Fri, 12 Oct 2018 06:05:54 GMT