Thursday 2 May 2013

Jquery - How to detect a click outside an element in a Page?

- If we want to detect a click outside an particular element (div),

 - Below Example the "header menus" displays normally when we click any of  place in a page except " form_container".

- If we the areas of  " form_container" then the header menu hide. (note initially header menu should be hide).



$('html').click(function() { 

//Hide the menus if visible $('#header_menus').display();

 });
$('#form_contatiner').click(function(event){ 

 event.stopPropagation();

 });

No comments:

Post a Comment