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-1.11.1.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<div id="header">
        <a href="javascript:;">111</a>
        <a href="javascript:;">222</a>
        <a href="javascript:;">333</a>
        <a href="javascript:;">444</a>
        <a href="javascript:;">555</a>
    </div>
    
    <div id="footer">
        <a href="javascript:void(0);">aaa</a>
        <span class="icon-rectangle">|</span>
        <a href="javascript:void(0);">bbb</a>
        <span class="icon-rectangle">|</span>
        <a href="javascript:void(0);">ccc</a>
        <span class="icon-rectangle">|</span>
        <a href="javascript:void(0);">ddd</a>
        <span class="icon-rectangle">|</span>
        <a href="javascript:void(0);">eee</a>
    </div>
</body>
</html>
 
$("#header a").click(function () {
        alert( $(this).index() );
    });
    
    $("#footer a").click(function () {
        alert( $(this).index('a') );
    });
Output

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

Dismiss x
public
Bin info
anonymouspro
0viewers