Thanks everyone!

This is what I ended up using:
var index = $(this).parent().children("th").index(this) + 1;

/N

On Nov 26, 6:58 pm, "Glen Lipka" <[EMAIL PROTECTED]> wrote:
> Getting the row is easier. :)  There is a rowIndex 
> attribute.http://commadot.com/jquery/rowindex.php
>
> Nuts, I am too late.  Question answered.  I whipped up a demo 
> anyway.http://commadot.com/jquery/colIndex.php
>
> Fun question.
>
> Glen
>
> On Nov 26, 2007 8:10 AM, jonhobbs <[EMAIL PROTECTED]> wrote:
>
>
>
> > I posted a very similar question yesterday, here -
>
> >http://groups.google.com/group/jquery-en/browse_thread/thread/c50d8ef...
>
> > I possibly worded the question badly and haven't had a reply yet but
> > would also be very interested in a neat way to do this.
>
> > People must often need a way to find out the index of an element
> > amongst it's siblings ?
>
> > Jon
>
> > On Nov 26, 3:35 pm, badtant <[EMAIL PROTECTED]> wrote:
> > > I have the following html:
>
> > > <table>
> > > <thead>
> > > <tr>
> > > <th>col a</th>
> > > <th>col b</th>
> > > <th>col c</th>
> > > </tr>
> > > </thead>
> > > <tbody>
> > > <tr>
> > > <td>aaa</td>
> > > <td>bbb</td>
> > > <td>ccc</td>
> > > </tr>
> > > </tbody>
> > > </table>
>
> > > When the user hovers the th-element I have a function. I want that
> > > function to return which of the columns that has been hovered. Let me
> > > explain... when hovering "col a" I want to get the value 1 and when
> > > hovering "col b" I want to get the value 2. Any suggestions on how can
> > > that be achieved?
>
> > > Thanks!
> > > /Niklas

Reply via email to