<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function () {
$("div").each(function (index, domEle) {
if ($(this).is("#stop")) {
$("span").text("#" + index);
return false;
}
});
});
});
</script>
</head>
<body>
<body>
<button>Click</button>
<span></span>
<div>asdf</div>
<div>asdf</div>
<div>asdf</div>
<div>asdf</div>
<div id="stop">Stop here</div>
<div>asdf</div>
<div>asdf</div>
<div>asdf</div>
</body>
</html>
|