How to find what number element $(this) refers to?
<pre><code>&lt;table&gt;
    &lt;tr&gt;
        &lt;th&gt;
            Title
        &lt;/th&gt;
        &lt;th&gt;
            Author
        &lt;/th&gt;
    &lt;tr&gt;
&lt;/table&gt;
</code></pre>

<p>That's a basic table</p>

<pre><code>$("th").click(function(){
    $(this).method();
});
</code></pre>

<p>All I want to do is call a method when a th tag is clicked but I want to know which one was clicked. So if Title is clicked I want it to return 0 because it's the first element and if Author is clicked return 1 because it's the second element.</p>

<p>I tried putting data-val= on the th tag but this doesn't validate so I removed it.</p>
