Can't use dynamic variable into JQuery function
<p>I want to disable TableSorter plugin on some th.
These th have class="disableSorter", so I do:</p>

<pre><code>$('.disableSorter').each(function(index) {

    $('.tablesorter').tablesorter({ headers: { index: { sorter: false} } }); 

});
</code></pre>

<p>where index: is the index variable passed in the function.
The thing is " index " is not replaced by the number (for example 0:, 1: 5:, etc.)</p>

<p>Thanks for help!</p>

<p><strong>===== Edit =====</strong></p>

<p>Thanks JaredPar, your solution was right about the dynamic variable. I had to edit the code because I wan't getting the index of the th element, but the index of the each loop.</p>

<p>Here's my final code</p>

<pre><code>var inner = {};
$('.disableSorter').each(function() {
    inner[$('.tablesorter th').index(this)] = { sorter: false };
});

$('.tablesorter').tablesorter({ headers: inner  }); 
</code></pre>
