How to loop through an array of jQuery objects?
<p>This works up until the for loop. If I add an alert within the for loop, it will go off only once. The jQuery selectors do work, and the styles are applied correctly, as I have them spread out like so:</p>

<pre><code>$('td[title="Product Sales Calculators - Displays a dynamic view of content from your site."]')
    .closest('.s4-wpTopTable')
    .find('tr:first')
    .next()
    .css('display','none');

$('td[title="Product Sales Calculators - Displays a dynamic view of content from your site."]')
    .children()
    .css('font-size','12px')
    .css('color','#696158')
    .css('font-weight','bold')
    .css('font-family','Arial')
    .css('textTransform','none');
$('td[title="Product Sales Calculators - Displays a dynamic view of content from your site."]')
    .parent()
    .children()
    .css('border','0');
$('td[title="Product Sales Calculators - Displays a dynamic view of content from your site."]')
    .closest('.s4-wpTopTable')
    .find('a:first img')
    .attr('src',Expand);
</code></pre>

<p>As you can see, I wanted to make this more efficient. </p>

<p>Once again, the for loop is breaking. Thanks in advance</p>

<pre><code>jQuery(function($) {

    $('.s4-wpTopTable').find('tr:first h3').prepend('&lt;a class=\'min\' style=\'float:left;width:10px;margin-top:-1px;\'&gt;&lt;img src=\'/_layouts/images/cacu/Arrow_dn.gif\'/&gt;&lt;/a&gt;');
        var Collapse = "/_layouts/images/cacu/Arrow_dn.gif";
        var Expand = "/_layouts/images/cacu/Arrow_rt.gif";

    $('.min').click(function(){
        var img = $(this).children();
        $(this).closest('.s4-wpTopTable').find('tr:first').next().toggle().is(":visible") ? img.attr('src',Collapse) : img.attr('src',Expand );
    });

    var $ProductSalesCalculators = $('td[title^="Product Sales Calculators"]');
    var $AllReportConnection = $('td[title^="All Report Connection"]');
    var $QualityReports = $('td[title^="Quality Reports"]');
    var $SalesDashboard = $('td[title^="Sales Dashboard"]');
    var $SalesResourceReports = $('td[title^="Sales Resource Reports"]');
    var $Departments = $('td[title^="Departments"]');
    var $SalesReports = $('td[title^="Sales Reports"]');
    var $BranchSuiteTabDirectory = $('td[title^="Branch Suite Tab Directory"]');

    var items = ['$ProductSalesCalculators','$AllReportConnection','$QualityReports','$SalesDashboard','$SalesResourceReports','$Departments','$SalesReports','$BranchSuiteTabDirectory'];

    for (var i = 0; i &lt; items.length; i++) {
         $(items[i]).closest('.s4-wpTopTable').find('tr:first').next().css('display','none');
         $(items[i]).children().css('font-size','12px').css('color','#696158').css('font-weight','bold').css('font-family','Arial').css('textTransform','none');
         $(items[i]).parent().children().css('border','0');
         $(items[i]).closest('.s4-wpTopTable').find('a:first img').attr('src',Expand);

    }
});
</code></pre>

<p>I have tried taking the <code>()</code> away from the <code>items[i]</code>, like so,</p>

<pre><code>$items[i].closest......
</code></pre>

<p>Also taking the <code>$</code> and <code>()</code> away like so:</p>

<pre><code>items[i].closest....
</code></pre>

<p>Thanks.</p>
