title: jQuery getting img src with variable?
body: <p>Ive have read like 100+ your topics on this, but no matter what i do i cant get it do like i want to. My problem is i get my <code>img src="url"</code> from my <code>script</code>. When i alert it it gives me the right input i want, but when i put it in the <code>attr()</code> tag i just posts "<code>imgSrc</code>" and that in the path to the image. When i hard code the images in the mouseover function it actully works.</p>
  
  <p>Heres my Script</p>
  
  <pre><code>  &lt;script&gt;
      $(document).ready(function(){
  
              //Hides the images
              $('#imgwrap img').hide();
  
              //Create variables for Link &amp; Images
              $('a.imgflash').mouseover(function(){
                  var linkRel     =   $(this).attr('rel');
  
                  $('#imgwrap img').each(function(i,ele){
                      if($(this).attr('rel') == linkRel) {
                          var imgSrc      =   $(this).attr('src');
                      }               
                  });
  
              });
  
              //Script that makes images apears
              //Mouseover Script
              $('a.imgflash').mouseover(function(){           
                  $('#imgwrap img').attr("src", imgSrc).show();
              });
          });
      &lt;/script&gt;
  </code></pre>
  
  <p>And heres my HTML</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li&gt;&lt;a rel="demo1" class="imgflash" href="#"&gt;demo1&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a rel="demo2" class="imgflash" href="#"&gt;demo2&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a rel="demo3" class="imgflash" href="#"&gt;demo3&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;div id="imgwrap" style="width:300px; height:300px; overflow:hidden;"&gt;
  &lt;img rel="demo1" src="images/lux.jpg"&gt;
      &lt;img rel="demo2" src="images/cover.jpg"&gt;
      &lt;img rel="demo3" src="images/cover2.jpg"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>i hope u can help me how to get my Variable "imgSrc" to post like i want to in my mouseover function.</p>