Tuesday, 10 April 2018

Changing and loading an iframe ‘src’ attribute with jQuery

how to set src of iframe using jquery

Description:
In this example we explain that how to set ‘src’ of Iframe using jQuery. Or jQuery to Force set ‘src’ attribute for iframe. Or how to change the iframe ‘src’ dynamically using JQuery. Or changing or loading an iframe ‘src’ attribute with jQuery. Or set or change the iframe ‘src’ attribute with jQuery. Or dynamically set the properties or attributes of the iframe using jQuery.

So here we demonstrate that how to changing and loading an iframe ‘src’ attribute with jQuery. Below is the client side jQuery code to set the src attribute of the iframe dynamically.
Code:

<<a href="http://aspsolutionkirit.blogspot.in" target="blog">Blog</a>
<iframe name="blog" id="blog" width="560" height="315"></iframe>

$(document).ready(function(){
    $("a").click(function(e) {
        e.preventDefault();
       
        $("#blog").attr("src", $(this).attr("href"));
    })
});



0 comments:

Post a Comment