I'm attempting to change data depending on the href of the link, but it only executes once
<pre><code>$("a").each(function() { openFile($(this).attr('href')); }
</code></pre>

<p>I got this from another question. openFile is a function that switches the img src depending on the file extension of the link. </p>

<p>now if i have this: </p>

<pre><code>&lt;a class="thelink" href="../General Reading/General Reading 1/Luddites/Luddites 4 Summary.pdf"&gt;&lt;img class="theimage" src="" alt="icon"/&gt; &lt;div class="thefile"&gt;&lt;/div&gt;&lt;/a&gt;
&lt;a class="thelink" href="../General Reading/General Reading 1/Luddites/Luddites 5 Reading.pdf"&gt;&lt;img class="theimage" src="" alt="icon"/&gt; &lt;div class="thefile"&gt;&lt;/div&gt;&lt;/a&gt;
&lt;a class="thelink" href="../General Reading/General Reading 1/Luddites/Luddites 1 Vocab.ppt"&gt;&lt;img class="theimage" src="" alt="icon"/&gt; &lt;div class="thefile"&gt;&lt;/div&gt;&lt;/a&gt;    
&lt;a class="thelink" href="../General Reading/General Reading 1/Luddites/Luddites 2 Grammar Preview.ppt"&gt;&lt;img class="theimage" src="" alt="icon"/&gt; &lt;div class="thefile"&gt;&lt;/div&gt;&lt;/a&gt;
</code></pre>

<p>My function is only run once at the end I guess and takes the info from the last url. What I want is to loop through each link and change the info depending on that specific link.</p>

<p>Err hard to explain.</p>
