Mega Code Archive

 
Categories / JavaScript Tutorial / JQuery
 

Returns the index for the element with ID foo within another element

< html>   <head>     <script type="text/javascript" src="js/jquery-1.3.2.js"></script>     <script type="text/javascript">         $(document).ready(function(){             alert($("*").index( $('#foo')[0] ));         });     </script>   </head>   <body>     <body>         <div id="foobar"><b></b><span id="foo"></span></div>     </body> </html>