How to get the index - table row -, when I click on li item in tooltip menu template
<p>Below is the code I am using. In my table, on hovering the sales column, I have a menu template tooltip that has 3 list items. When clicking on one of these li items, I want to know the table row/ index the sales column is in.
Code below:</p>

<pre><code>&lt;td&gt;
    &lt;a href='#' class = 'sales_tooltip' data-templatename='Conifer' 
        data-title='&lt;div class = "tooltip-menu"&gt;
                    &lt;ul&gt;&lt;li class="sales_rep"&gt;&lt;a href="#"&gt;Sales Rep 1&lt;/a&gt;&lt;/li&gt;
                    &lt;li class="sales_rep"&gt;&lt;a href="#"&gt;Sales Rep 2&lt;/a&gt;&lt;/li&gt;
                    &lt;li class="last-child sales_rep"&gt;&lt;a href="#"&gt;Sales Rep 3&lt;/a&gt;&lt;/li&gt;

                    &lt;/ul&gt;
                    &lt;/div&gt;'&gt; 
        &lt;i class = 'fa fa-male ' aria-hidden='true'&gt;&lt;/i&gt;    
    &lt;/a&gt;
&lt;/td&gt;
</code></pre>

<p>I want the tr index of the row, whose li item tooltip I clicked on.
javascript code</p>

<pre><code>$('body').on('click', '.tooltip-menu li.sales_rep', function() {

    if(confirm("Have you chosen your sales rep?")){
        var sales_rep = $(this).find("a").html();

        //var $index = $(this).closest('a').closest('tr').index();
        var $index = $('#'+ $(this).data('for')).closest('tr').index();
    }
</code></pre>

<p>I tried this but this is not working, as it returns -1.
Please help</p>