Quantcast
Channel: SwhistleSoft Blog » javascript
Viewing all articles
Browse latest Browse all 8

Using Jquery in an iframe

$
0
0

Although it may not seem like an easy task at first, it is quite possible to use jquery inside of an iframe. The first trick involves loading jquery inside the iframe code itself.

Html Containing Iframe

<html>
<head>
<title>Jquery Iframe Test</title>
<script type='text/javascript' src='javascript/jquery.min.js'></script>
</head>
<body><br /><div id='manip'></div>
<iframe src='jquery-frame.html'></iframe&>
</body>
</html>

Html in Iframe

<html>
<head>
<title>Jquery Iframe Test</title>
<script type='text/javascript' src='javascript/jquery.min.js'></script>
<script type='text/javascript' src='custom.js'></script>
</head>
<body>
</body>
</html>

custom.js source Code

$(document).ready(function(){
$(window).parent("#manip").html("test");
});

Viewing all articles
Browse latest Browse all 8

Trending Articles