Unable to change value of variable having a element in jquery
<p>I need to iterate through some elements in a div and change a value using jQuery. Here's my code which doesn't seem to be working. Kindly highlight my errors. </p>

<pre><code>var f=$(".Midfeilders img:first"); // used to store 1st element in a variable ... 
</code></pre>

<p>Later on in the code what I wish to do is </p>

<pre><code>{
  f.attr("src",s);
  f=f.next() or f=f.nextSibling;
}
</code></pre>

<p>Here's the error, this doesn't seem to change the value of src </p>

<p>When I do something like this,</p>

<pre><code>$(".Midfeilders img").attr("src",s);
</code></pre>

<p>The code runs perfectly, but if I use the above approach I can't go to the next element.
I suspect its the  f.attr("src",s) which seems to be the issue.</p>
