Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Reload iFrame | jQuery Refresh iFrame

Apr 24, 2013
Introduction

Here I will explain how to use  
jQuery to refresh or reload iframe using jQuery. By using simple jQuery property we can refresh or reload an iframe on the page using jQuery.

Description:
  
In previous post I explained
jQuery count number of vowels in string, Get Screen resolution of client machine in JavaScript, split the string using split function in jquery and many articles relating to code snippets, JQuery, JavaScript. Now I will explain how to reload iframe using jQuery.

If we want to refresh or reload an iframe using jQuery we need to write the code like as shown below


//Reload iframe
$('#testframe').attr('src', $('#testframe').attr('src'));

If you want see complete example check below code


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>jQuery Reload iframe</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function() {
$('#btnRefresh').click(function() {
$('#testframe').attr('src', $('#testframe').attr('src'));
});
});
</script>
</head>
<body>
<div>
<input type="submit" name="go" id="btnRefresh" value="Refresh Iframe"/><br />
<iframe id="testframe" src="http://www.aspdotnet-suresh.com" width="350px" height="350px"></iframe>
</div>
</body>
</html>
Demo

To check demo change click on button


If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

2 comments :

Unknown said...

Thats what i want...thank u so much suresh sir.....

Unknown said...

thank you suresh it works fine...

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.