Dynamic jQuery Selectors, variable problem
<p>I'm just trying to make a list of questions with hidden answers that shows upon click. My code hides all divs, but when I click on the anchors, only the last box is toggled.  In this case, every anchor toggles the 5th box, and not their own.</p>

<pre><code>for(var i=1; i&lt;6; i++){
    var x = i+"";
    $("#box"+ x).hide();
    $("#feature"+x).click(function(){
        $("#box"+x).toggle(400);
    });
}
</code></pre>

<p>My basic HTML looks like this, but with 5   pairs:</p>

<pre><code>&lt;p&gt;&lt;a id="feature1" href="#"&gt;1. Absent Message&lt;/a&gt;&lt;/p&gt;
&lt;div id="box1"&gt;Stuff here 1&lt;/div&gt;
&lt;p&gt;&lt;a id="feature2" href="#"&gt;2. Alarm Setting&lt;/a&gt;&lt;/p&gt;
&lt;div id="box2"&gt;Stuff here 2&lt;/div&gt;
</code></pre>

<p>If I wrote out the functions without using the for loop and string concatenation, the functions do what I want them to. Can someone point me in the right direction? Am I doing something wrong with the string manipulation?</p>
