title: changing iframe source with jquery
body: <p>I've been trying this for a bit now and have looked at other answers to similar questions on SO, but when I am trying to change the src attribute of an iframe, it updates it for the whole window. Here is the following code I am using that works correctly (no jquery):</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;style type="text/css"&gt;
  iframe#ifrm { 
      border:none;
      padding:.5em;
      margin:1.5em 0 1em;
      width:100%;
      height:100%;
  }
  &lt;/style&gt;
  &lt;script src="./js/jquery-1.4.2.js" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  // &lt;![CDATA[
      // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      // this is the function I'm trying to replace:
      function loadIframe(iframeName, url) {
      if ( window.frames[iframeName] ) {
          window.frames[iframeName].location = url;   
          return false;
      }
      return true;
  }
  // ]]&gt;
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;a href="http://www.google.com/" onclick="return loadIframe('ifrm', this.href)"&gt;Page 1&lt;/a&gt; &lt;/li&gt;
  &lt;li&gt;&lt;a href="tabs.html" onclick="return loadIframe('ifrm', this.href)"&gt;Page 2&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  &lt;div class="iframe"&gt;
  &lt;iframe name="ifrm" id="ifrm" src="tabs.html" frameborder="0"&gt;
  Your browser doesn't support iframes.&lt;/iframe&gt;
  </code></pre>
  
  <p>
  
  </p>
  
  <p>As I said, I've tried </p>
  
  <pre><code>$('#ifrm').attr('src', "http://www.google.com")
  </code></pre>
  
  <p>which displays the page, but not in the iframe. I'm really just learning jquery, but I can't figure out what's different about my situation than other similar questions like this:</p>
  
  <p><a href="https://stackoverflow.com/questions/1477291/jquery-and-iframe-update">Jquery and iFrame update</a></p>
  
  <p>Thanks.</p>