Show div once clicked and hide when clicking outside
问题 I'm trying to show the #subscribe-pop div once a link is clicked and hide it when clicking anywhere outside it. I can get it to show and hide if I change the: $('document').click(function() { TO $('#SomeOtherRandomDiv').click(function() { HTML: <div id="footleft"> <a href="#" onclick="toggle_visibility('subscribe-pop');">Click here to show div</a> <div id="subscribe-pop"><p>my content</p></div> </div> Script: <script type="text/javascript"> function toggle_visibility(id) { var e = document