Core/API/jQuery - Sample Code
index(subject)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
window.onload = (function(){try{
$("div").click(function () {
// this is the dom element clicked
var index = $("div").index(this);
$("span").text("That was div index #" + index);
});
}catch(e){}});</script>
<style>
div { background:yellow; margin:5px; }
span { color:red; }
</style>
<style>html,body{border:0; margin:0; padding:0;}</style></head>
<body>
<span>Click a div!</span>
<div>First div</div>
<div>Second div</div>
<div>Third div</div>
</body>
</html>
[実行結果]