Javascript examples for DOM:Event
Check event element id
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.3.min.js"></script> <script type="text/javascript"> $(window).load(function(){/* w w w .j a v a 2 s. co m*/ $('#outer').click(function(e) { if (e.target.id === "outer") $('#outer').fadeOut(); }); }); </script> </head> <body> <div id="outer"> ttttttttt <div id="inner"> aaaaaaaaaaaaa </div> </div> </body> </html>