Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Create iframe dynamically using jQuery

Hello Friends,

Creating iframe using jQuery is not a difficult task. If you want to create iframe dynamically using jQuery, than look at below code.

Below is the code for generating dynamic iframe with jQuery.

$('<iframe />');  // Create an iframe element

$('<iframe />', {

    name: 'frame1',

    id: 'frame1',

src: 'http://www.programmingfacts.com'


// For older version of jQuery

$('<iframe />').attr('src', 'http://www.programmingfacts.com'); // Add iframe attributes


You can add iframe attribute as second parameter as per jQuery 1.4. For older version of jQuery, you can refer the syntax mention as above. If you find any problem in this than let me know by comment.



Leave a Reply

Your email address will not be published.