Event on a click everywhere on the page outside of the specific div

后端 未结 4 1329
我在风中等你
我在风中等你 2020-12-03 12:23

I\'d like to hide a div when user click anywhere on the page outside of that div. How can I do that using raw javascript or jQuery?

4条回答
  •  悲哀的现实
    2020-12-03 12:38

    First idea, in raw javascript (from this post):

    
    
      
        Untitled Document
        
        
        
        
        
      
      
        
    my div

    Tested with IE6 and FireFox3.1, it does work as advertised.

提交回复
热议问题