Returns -1, as there is no element with ID bar.
<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
alert($("*").index( $('#foo1')[0] ));
});
</script>
</head>
<body>
<body>
<div id="foobar"><b></b><span id="foo"></span></div>
</body>
</html>
Related examples in the same category