[jQuery] Checkbox: Selecting all Previous

[jQuery] Checkbox: Selecting all Previous

<div>This might be a newbie question, but I am having trouble with it.</div>
<div> </div>
<div>I have 4 checkboxes vertical</div>
<div>
<div> </div>
<div><input type="checkbox"><label>box 1</label><br />  
<div><input type="checkbox"><label>box 1 and 2</label><br />  
<div><input type="checkbox"><label>box 1 and 2 and 3</label><br />
<div><input type="checkbox"><label>box 1 and 2 and 3 and 4</label><br /></div>
<div> </div>
<div>When I click one, I want to check the boxes of all the ones previous to it (including it).  And uncheck all the boxes after it.</div>
<div> </div>
<div>How would I structure the statement in jQuery to select?  I am trying to avoid the FOR loop.</div>
<div> </div>
<div>This gives me the last one.</div>
<div>var lastOne = $("#myForm input[@type=checkbox]:checked:last");</div>
<div> </div>
<div>Not sure how to use this.  I tried prev() but that didnt seem to work.</div>
<div> </div>
<div>Thanks for the help,</div>
<div>
Glen</div>
<div> </div></div></div></div></div>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/