Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>Event Example</title>
  <style>
    li.selected {
      color: green;
    }
  </style>
</head>
<body>
<p>In two seconds, the third item will turn green and you'll see an alert.</p>
<ul id="slider">
    <li class="">xxxxx</li>
    <li class="">xxxxx</li>
    <li class="">xxxxx</li>
    <li class="">xxxxx</li>
    <li class="">xxxxx</li>
    <li class="">xxxxx</li>
    <li class="">xxxxx</li>
  </ul>
  <script>
    $("#slider").on("added-class", function() {
      alert("Changed");
    });
    setTimeout(function() {
      $("#slider li").eq(2).addClass("selected").trigger("added-class");
    }, 2000);
  </script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers