Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <br>
  <br>
  <br>
  <br>
  <br>
  <a href="">A Link</a>
</body>
</html>
 
var obj = {
  init: function() {
    $('body').on('click', 'a', this._onClick.bind(this));
  },
  
  _onClick: function(e) {
    e.preventDefault();
    
    console.log({
      el1: e.target, // same
      el2: e.currentTarget, // same
      obj: this
    });
  }
};
obj.init();
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers