Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.4.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <div id="div"></div>
</body>
</html>
 
div{
  width: 100px;
  height: 100px;
  position: absolute;
  background: red;
  left: 0;
  top: 0;
}
 
$(function(){
  $(document).on('click', function(e){
    alert('document click');
  });
  $('#div').on('click', function(e){
    alert('div click');
    e.stopPropagation();
  });
  $(document).on('contextmenu', function(e){
//     e.preventDefault();
  });
});
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers