Jquery copy attributes
<p>I google it up but didn' find something like this.</p>

<p>I am having an iframe with 2 main attributes src=# and link=<a href="http://somesite.com" rel="nofollow">http://somesite.com</a></p>

<pre><code>&lt;iframe id="myiframe" src="#" link="https://somesite.com?id=x&amp;anotherid=y" style="position:absolute; left:0px; top:0px; width:99%; min-width:80%; height:99%; min-height:80%; padding:0px;"&gt;&lt;/iframe&gt;
</code></pre>

<p>I load that iframe in HTML from some php script but i don't want to load the page thats why i used # as source, now when i click a button on the site it will load the iframe (if it was not loaded from a previous click), my temporary solution was: </p>

<pre><code>&lt;input type="button" value="load" onClick="var fr = document.getElementById('myiframe');if(fr.src.substr(-1)=='#'){fr.src=document.fr.getAttribute('link')};" /&gt;
</code></pre>

<p>Now I had a little time to implement the jQuery and I whant to know if there is some simple code in jQuery to copy from an attribute to another, or if there is a better solution to accomplish this.</p>

<p>something like this:
    $('#myiframe').attr('src', attr('link'));</p>

<p>i know the folowing will work</p>

<pre><code>$('#myiframe').attr('src', attr('link'));
</code></pre>

<p>but i think is not to much to select the same element twice. (I am kind of an optimizer maniac :) )</p>

<p>or you think that I have to use a function:</p>

<pre><code>$('#myiframe').attr('src', function(){
    ...
});
</code></pre>

<p>My question is what is the best way to achieve this.  Thank you.</p>
