Change src of iframe dynamically - Javascript jQuery

Javascript examples for jQuery:iframe

Description

Change src of iframe dynamically

Demo Code

ResultView the demo in separate window

<html>
   <head>
      <script src="https://code.jquery.com/jquery-3.1.1.min.js" crossorigin="anonymous"></script> 
      <script>
   $(document).ready(function() {
       $('#test').attr('src','http://www.bing.com');
   });//  w  ww  .  j ava 2  s  .  com

      </script> 
   </head>
   <body> 
      <iframe id="test" src="https://www.w3schools.com"> </iframe>  
   </body>
</html>

Related Tutorials