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.
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. |
|||
|
|||
2 comments :
Thats what i want...thank u so much suresh sir.....
thank you suresh it works fine...
Note: Only a member of this blog may post a comment.