Check event element id - Javascript DOM

Javascript examples for DOM:Event

Description

Check event element id

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials