javascript - Add domain to relative URLS inside iFrame -


i have small problem hoping may able with. page setup bit weird serve purpose.

i have iframe lists bunch of articles links in headings. trying add domain each url. btw iframe sitting on same domain.

the code have works grabs first link, adds domain , copies same url each link on page. must stuck in sort of loop.

code:

jquery('#iframe').contents().find("h3.title a").attr("href", "http://www.mydomain.com" + jquery('#iframe').contents().find("h3.title a").attr("href") ); 

html:

<h3 class="title"><a href="/article1.html">article 1</a></h3> <p>article text</p>    

i end each article:

<h3 class="title"><a href="http://www.mydomain.com/article1.html">article 1</a></h3> <p>article text</p>  <h3 class="title"><a href="http://www.mydomain.com/article2.html">article 2</a></h3> <p>article text</p>  etc... 

i'm not of jquery guru, can't seem figure out. i'm sure has looping start , requires each or declaration somewhere...

please let me know if need more info.

cheers palle

ok...

i seem have figured out. bit of fluke must admit.

jquery('#iframe').contents().find("h3.title a").each(function(){this.href = this.href}); 

i hope helps similar problems.