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>
    <div id="box">
     click me
    </div>
    <p>Using $(this) with an arrow function (this will not work)</p>
    <script src="https://code.jquery.com/jquery-3.1.0.js"></script>
  </body>
</html>
 
#box {
  width: 100px;
  height: 100px;
  border: 1px solid black;
  text-align: center;
}
.blue {
  background-color: blue;
}
button {
  margin-top: 10px;
}
 
$(() => {
  
  $("#box").click(() => {
    // use $(this) with with an arrow function 
    // this will not work
    $(this).fadeOut(1000)
  })
})
Output

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

Dismiss x