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>
<script src="https://code.jquery.com/jquery-3.0.0.js"></script>
<ul id="list">
  <li data-value="1"><span data-value="nested">One</span></li>
  <li data-value="2">Two</li>
  <li data-value="3">Three</li>
</ul>
</body>
</html>
 
jQuery(document).ready(($) => {
  $('#list li').on('click', function(e) {
    console.log( $(e.target).data('value') );
    console.log( $(e.currentTarget).data('value') );
  });
})
Output 300px

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers