var th = $('table th');
th.mouseover(function(){
    var colNum = th.index(this) + 1;
  });

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