Reload an iframe with jQuery

Matt Elhotiby picture Matt Elhotiby · Nov 22, 2010 · Viewed 323.6k times · Source

I have two iframes on a page and one makes changes to the other but the other iframe doesn't show the change until I refresh. Is there an easy way to refresh this iframe with jQuery?

<div class="project">
  <iframe id="currentElement" class="myframe" name="myframe" src="http://somesite.com/something/new"></iframe>
</div>

Answer

Šime Vidas picture Šime Vidas · Nov 22, 2010
$( '#iframe' ).attr( 'src', function ( i, val ) { return val; });