Check out ".index()":

http://docs.jquery.com/Core/index

the example is just like what you want, except they are <div>'s

On Oct 22, 4:21 pm, frank <frankp...@gmail.com> wrote:
> Hello I'm just a starter and I'm looking for a function I can't find.
>
> What I want:
> I want the row number of the row i clicked of the item list.
>
> For instance I click on third row then I want that var i returns 2.
>
> My code:
>
> <html>
>   <head>
>     <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
>     <script type="text/javascript">
>         $(document).ready(function(){
>             $("ls").click(function () {
>                var i = $( what must i type to get the clicked row
> number here??);
>                console.log(i);
>             });
>         });
>     </script>
> </head>
>     <body>
>       <ul>
>           <ls>First <br></ls>
>           <ls>Second <br></ls>
>           <ls>Third <br></ls>
>           <ls>Forth <br></ls>
>       </ul>
>     </body>
> </html>
>
> Best Regards
> Frank Pauw

Reply via email to