0

How will I refresh each iframe onclick? Thanks! Here's my js:

function Reload()
{
          $("#load").each(function()
          {
                    if($(this).is(':visible'))
                              $(this).attr('src', $(this).attr('src'));
          });
}

My iframe:

<iframe src="SALES/add.php" id="load" width="100%" height="670px" frameborder="1" margin="0" padding="0" scrolling="yes">
                    </iframe>                               
fly_ninja
  • 53
  • 9

1 Answers1

0

looks like you have duplicate IDs for iframe. IDs should be unique. For targetting all iframe you can use selector $("iframe"):

 $("iframe").each(function(){
         if($(this).is(':visible'))
           $(this).attr('src', $(this).attr('src'));
 });

or

 $( 'iframe' ).attr('src',function(i,src){return src;});

Reference answer by Šime Vidas

Community
  • 1
  • 1
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125