Using javascript to insert id into list elements
<p>I am messing around with a deck of cards that I made.I have it set up so that there is a method that spits out cards by suit into a list, so if I want spades I get a <code>&lt;ol&gt;</code> of all of the spades cards. I am now trying to give each <code>&lt;li&gt;</code> element an id depending on what card it is. ace will be <code>&lt;li id="ace"&gt;&lt;img src="ace_spades.gif"/&gt;&lt;/li&gt;</code> king will be <code>&lt;li id="king"&gt;&lt;img src="king_spades.gif"/&gt;&lt;/li&gt;</code> for example.The list is in order from top to bottom akqj1098765432 . I tried doing this:</p>

<pre><code>var card_id=["ace","king","queen","jack","ten","nine","eight","seven","six","five","four", "three","two"];
var counter=0;
while (counter&lt;=12)
    {
    $(document).ready(function(){
    $("li").eq(counter).attr("id", card_id[counter])
        });
    counter++;
    }
</code></pre>

<p>but it doesn't work. I have not really done anything with javascript before besides simple jquery stuff. What am I getting wrong here?</p>
