$('body').click(function(event) { if (!$(event.target).is('p')) { $("#e2ma-menu").hide(); } }); p is the element name. Where one can pass the id or class or element name also. p is the element name. Where one can pass the id or class or element name also.