Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<ul>
  <li>hello 1</li>
  <li>hello 2</li>
  <li>hello 3</li>
  <li>hello 4</li>
</ul>
</body>
</html>
 
const ul = document.querySelectorAll('ul')[0]
ul.addEventListener('click', function(e) {
  let oLi1 = e.target
  let oLi2 = e.currentTarget
  console.log(oLi1.tagName); //  被点击的li
  console.log(oLi2.tagName); // ul
  console.log(oLi1 === oLi2); // false
})
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers